mirror of
https://github.com/linux-do/new-api.git
synced 2025-09-24 02:46:37 +08:00
22 lines
339 B
JavaScript
22 lines
339 B
JavaScript
export const reducer = (state, action) => {
|
|
switch (action.type) {
|
|
case 'login':
|
|
return {
|
|
...state,
|
|
user: action.payload,
|
|
};
|
|
case 'logout':
|
|
return {
|
|
...state,
|
|
user: undefined,
|
|
};
|
|
|
|
default:
|
|
return state;
|
|
}
|
|
};
|
|
|
|
export const initialState = {
|
|
user: undefined,
|
|
};
|