import { queryUserList } from "../../../services/user";

export default {
    namespace: 'taskUser',
  state: {
    userList: [],
  },
  effects: {
    *fetchUserList({ payload }, { call, put }) {
      const response = yield call(queryUserList, payload);
      if (response) {
        yield put({
          type: 'userListHandler',
          payload: response.data,
        });
      }
    },
  },

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