reducer.js 341 B

1234567891011121314151617181920
  1. export const reducer = (state, action) => {
  2. switch (action.type) {
  3. case 'set':
  4. return {
  5. ...state,
  6. status: action.payload,
  7. };
  8. case 'unset':
  9. return {
  10. ...state,
  11. status: undefined,
  12. };
  13. default:
  14. return state;
  15. }
  16. };
  17. export const initialState = {
  18. status: undefined,
  19. };