import { routerRedux } from 'dva/router';
import * as userEditService from '../../services/FM/userEdit';

export default {

  namespace: 'FMUserEdit',
  state: {
  },

  subscriptions: {
    setup({ dispatch, history }) {  // eslint-disable-line

    },
  },

  effects: {
    *getUser ({ payload,onComplete }, { call, put }) {
      const ret = yield call(userEditService.getUser, payload);
      if (typeof onComplete === 'function') {
        onComplete(ret)
      }
    },
    *getBtnList({ payload,onComplete }, { call, put }) {
      const ret = yield call(userEditService.getBtnList, payload);
      if (typeof onComplete === 'function') {
        onComplete(ret)
      }
    },
    *updateUser ({ payload, onComplete }, { call, put}) {
      const ret = yield call(userEditService.updateUser, payload);
      if (typeof onComplete === 'function') {
        onComplete(ret)
      }
    },
  },

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

};
