import { getGoodsLevelDataAPI } from "../services/api";

export default {
  namespace: "goodsLevel",

  state: {
    goodsLevelData: []
  },

  effects: {
    *getGoodsLevel({ payload }, { call, put }) {
      const response = yield call(getGoodsLevelDataAPI, payload);
      yield put({
        type: "goodsLevelData",
        goodsLevelData: response
      });
    }
  },

  reducers: {
    goodsLevelData(state, payload) {
      return {
        ...state,
        goodsLevelData: payload.goodsLevelData
      };
    }
  }
};
