芝麻web文件管理V1.00
编辑当前文件:/home/freeclou/app.optimyar.com/backend/.cache/admin/src/hooks/useFetchPermissionsLayout/reducer.js
/* eslint-disable consistent-return */ import produce from 'immer'; export const initialState = { data: {}, error: null, isLoading: true, }; const reducer = (state, action) => produce(state, draftState => { switch (action.type) { case 'GET_DATA': { draftState.isLoading = true; draftState.data = {}; draftState.error = null; break; } case 'GET_DATA_SUCCEEDED': { draftState.data = action.data; draftState.isLoading = false; draftState.error = null; break; } case 'GET_DATA_ERROR': { draftState.isLoading = false; draftState.error = action.error; break; } default: return draftState; } }); export default reducer;