fix: run prettier

This commit is contained in:
ckt1031
2023-07-15 21:14:40 +08:00
parent 0424baef6a
commit caabdd1e21
49 changed files with 1087 additions and 582 deletions

View File

@@ -16,4 +16,4 @@ export const StatusProvider = ({ children }) => {
{children}
</StatusContext.Provider>
);
};
};

View File

@@ -1,19 +1,19 @@
// contexts/User/index.jsx
import React from "react"
import { reducer, initialState } from "./reducer"
import React from 'react';
import { reducer, initialState } from './reducer';
export const UserContext = React.createContext({
state: initialState,
dispatch: () => null
})
dispatch: () => null,
});
export const UserProvider = ({ children }) => {
const [state, dispatch] = React.useReducer(reducer, initialState)
const [state, dispatch] = React.useReducer(reducer, initialState);
return (
<UserContext.Provider value={[ state, dispatch ]}>
{ children }
<UserContext.Provider value={[state, dispatch]}>
{children}
</UserContext.Provider>
)
}
);
};

View File

@@ -3,12 +3,12 @@ export const reducer = (state, action) => {
case 'login':
return {
...state,
user: action.payload
user: action.payload,
};
case 'logout':
return {
...state,
user: undefined
user: undefined,
};
default:
@@ -17,5 +17,5 @@ export const reducer = (state, action) => {
};
export const initialState = {
user: undefined
};
user: undefined,
};