Commit 69a9d9bb authored by ι™ˆεΈ…'s avatar ι™ˆεΈ… Committed by niko

Unlimited list to add a special method (#451)

parent c03d59b5
......@@ -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,
......
......@@ -32,7 +32,7 @@ export default class SearchList extends Component {
fetchMore = () => {
this.props.dispatch({
type: 'list/fetch',
type: 'list/appendFetch',
payload: {
count: pageSize,
},
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment