model.js
491 Bytes
import { queryFakeList } from './service';
export default {
namespace: 'BLOCK_NAME',
state: {
list: [],
},
effects: {
*fetch({ payload }, { call, put }) {
const response = yield call(queryFakeList, payload);
yield put({
type: 'queryList',
payload: Array.isArray(response) ? response : [],
});
},
},
reducers: {
queryList(state, action) {
return {
...state,
list: action.payload,
};
},
},
};