text: import {queryCmsPostCategory, updateCmsPostCategory, destroyCmsPostCategory , storeCmsPostCategory, enableCmsPostCategory} from '@/services/cmspostcategory';
  import {checkRespData} from '@/utils/BdHelper';
  
  export default {
    namespace: 'cmspostcategory',
  
    state: {
      data: {
        list: [],
        pagination: {},
        treeData: [],
        common: [],
      },
    },
  
    effects: {
      *fetch({ payload, callback }, { call, put }) {
        const response = yield call(queryCmsPostCategory, payload);
        yield put({
          type: 'save',
          payload: response,
        });
        if (callback) callback();
      },
      *store({ payload, callback }, { call, put }) {
        const response = yield call(storeCmsPostCategory, payload);
        if(!checkRespData(response, 'store')){
          return;
        }
        yield put({
          type: 'save',
          payload: response,
        });
        if (callback) callback();
      },
      *destroy({ payload, callback }, { call, put }) {
        const response = yield call(destroyCmsPostCategory , payload);
  
        if(!checkRespData(response, 'destroy')){
          return;
        }
  
        yield put({
          type: 'save',
          payload: response,
        });
        if (callback) callback();
      },
      *update({ payload, callback }, { call, put }) {
        const response = yield call(updateCmsPostCategory, payload);
  
        if(!checkRespData(response, 'update')){
          return;
        }
  
        yield put({
          type: 'save',
          payload: response,
        });
        if (callback) callback();
      },
  
      *enable({ payload, callback }, { call, put }) {
        const response = yield call(enableCmsPostCategory, payload);
  
        if(!checkRespData(response, 'enable')){
          return;
        }
  
        yield put({
          type: 'save',
          payload: response,
        });
        if (callback) callback();
      },
    },
  
    reducers: {
      save(state, action) {
        return {
          ...state,
          data: action.payload.data,
        };
      },
    },
  };
  