profile.js 752 Bytes
Newer Older
sorrycc's avatar
sorrycc committed
1
import { queryBasicProfile, queryAdvancedProfile } from '@/services/api';
2 3 4 5 6

export default {
  namespace: 'profile',

  state: {
ddcat1115's avatar
ddcat1115 committed
7 8 9 10
    basicGoods: [],
    advancedOperation1: [],
    advancedOperation2: [],
    advancedOperation3: [],
11 12 13
  },

  effects: {
14 15
    *fetchBasic({ payload }, { call, put }) {
      const response = yield call(queryBasicProfile, payload);
16 17 18 19
      yield put({
        type: 'show',
        payload: response,
      });
ddcat1115's avatar
ddcat1115 committed
20
    },
afc163's avatar
afc163 committed
21
    *fetchAdvanced(_, { call, put }) {
ddcat1115's avatar
ddcat1115 committed
22 23 24 25 26
      const response = yield call(queryAdvancedProfile);
      yield put({
        type: 'show',
        payload: response,
      });
27 28 29 30 31 32 33 34 35 36 37 38
    },
  },

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