text: import { queryFakeList } from '../services/api';
  
  export default {
    namespace: 'list',
    state: {
      list: [],
      loading: false,
    },
    effects: {
      *fetch({ payload }, { call, put }) {
        yield put({
          type: 'changeLoading',
          payload: true,
        });
        const response = yield call(queryFakeList, payload);
        yield put({
          type: 'queryList',
          payload: Array.isArray(response) ? response : [],
        });
        yield put({
          type: 'changeLoading',
          payload: false,
        });
      },
      *appendFetch({ payload }, { call, put }) {
        yield put({
          type: 'changeLoading',
          payload: true,
        });
        const response = yield call(queryFakeList, payload);
        yield put({
          type: 'appendList',
          payload: Array.isArray(response) ? response : [],
        });
        yield put({
          type: 'changeLoading',
          payload: false,
        });
      },
    },
  
    reducers: {
      queryList(state, action) {
        return {
          ...state,
          list: action.payload,
        };
      },
      appendList(state, action) {
        return {
          ...state,
          list: state.list.concat(action.payload),
        };
      },
      changeLoading(state, action) {
        return {
          ...state,
          loading: action.payload,
        };
      },
    },
  };
  