1234567891011121314151617181920212223242526272829 |
- /* eslint-disable no-param-reassign */
- import produce from 'immer';
- import { ReduxActionTypes } from '../../constants/actionTypes';
- export const initialState = {
- data: {},
- isLoading: false,
- error: false,
- };
- const clock = (state = initialState, action) => (
- produce(state, (draft) => {
- switch (action.type) {
- case ReduxActionTypes.FETCH_DATA:
- draft.isLoading = true;
- break;
- case ReduxActionTypes.FETCH_DATA_SUC:
- draft.isLoading = false;
- break;
- case ReduxActionTypes.FETCH_DATA_FAL:
- draft.isLoading = false;
- break;
- default:
- break;
- }
- })
- );
- export default clock;
|