|
|
|
@ -10,6 +10,21 @@ export default { |
|
|
|
|
|
|
|
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, |
|
|
|
@ -27,6 +42,12 @@ export default { |
|
|
|
}, |
|
|
|
|
|
|
|
reducers: { |
|
|
|
queryList(state, action) { |
|
|
|
return { |
|
|
|
...state, |
|
|
|
list: action.payload, |
|
|
|
}; |
|
|
|
}, |
|
|
|
appendList(state, action) { |
|
|
|
return { |
|
|
|
...state, |
|
|
|
|