{"size": 1141, "ext": "js", "max_stars_repo_path": "src/pages/Transaction/models/collect.js", "max_stars_repo_name": "lsdlab/djshop_admin", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/pages/Transaction/models/collect.js", "max_issues_repo_name": "lsdlab/djshop_admin", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/pages/Transaction/models/collect.js", "max_forks_repo_name": "lsdlab/djshop_admin", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 20.0175438596, "max_line_length": 61, "alphanum_fraction": 0.5442594216}
import {
  queryCollects,
  patchCollect,
  confirmCollectPickup,
  fetchStoreAllIds,
} from '@/services/api';

export default {
  namespace: 'collect',

  state: {
    data: {
      results: [],
      count: undefined,
    },
    allStoreIds: [],
  },

  effects: {
    *fetch({ payload }, { call, put }) {
      const response = yield call(queryCollects, payload);
      yield put({
        type: 'save',
        payload: response,
      });
    },
    *patch({ payload, transactionID }, { call, put }) {
      yield call(patchCollect, payload, transactionID);
    },
    *confirmCollectPickup({ transactionID }, { call, put }) {
      yield call(confirmCollectPickup, transactionID);
    },
    *fetchStoreAllIds({}, { call, put }) {
      const response = yield call(fetchStoreAllIds);
      yield put({
        type: 'saveStoreAllIds',
        payload: response,
      });
    },
  },

  reducers: {
    save(state, action) {
      return {
        ...state,
        data: action.payload,
      };
    },
    saveStoreAllIds(state, action) {
      return {
        ...state,
        allStoreIds: action.payload,
      };
    },
  },
};
