text: import { query as queryUsers, queryCurrent } from '@/services/user';
  import {apiPatchCurrentUser} from "../services/api";
  
  export default {
    namespace: 'user',
  
    state: {
      list: [],
      currentUser: {},
    },
  
    effects: {
      *fetch(_, { call, put }) {
        const response = yield call(queryUsers);
        yield put({
          type: 'save',
          payload: response,
        });
      },
      *fetchCurrent(_, { call, put }) {
        const response = yield call(apiPatchCurrentUser);
        yield put({
          type: 'saveCurrentUser',
          payload: response.data,
        });
      },
    },
  
    reducers: {
      save(state, action) {
        return {
          ...state,
          list: action.payload,
        };
      },
      saveCurrentUser(state, action) {
        return {
          ...state,
          currentUser: action.payload || {},
        };
      },
      changeNotifyCount(state, action) {
        return {
          ...state,
          currentUser: {
            ...state.currentUser,
            notifyCount: action.payload.totalCount,
            unreadCount: action.payload.unreadCount,
          },
        };
      },
    },
  };
  