diff --git a/src/models/list.js b/src/models/list.js index 06d25a93849e616d0d23e10f79f1121ff37481ca..4758edaaa0a1611beb9ab8adf225202445f41468 100644 --- a/src/models/list.js +++ b/src/models/list.js @@ -15,6 +15,13 @@ export default { payload: Array.isArray(response) ? response : [], }); }, + *appendFetch({ payload }, { call, put }) { + const response = yield call(queryFakeList, payload); + yield put({ + type: 'appendList', + payload: Array.isArray(response) ? response : [], + }); + }, *submit({ payload }, { call, put }) { let callback; if (payload.id) { @@ -37,5 +44,11 @@ export default { list: action.payload, }; }, + appendList(state, action) { + return { + ...state, + list: state.list.concat(action.payload), + }; + }, }, }; diff --git a/src/pages/List/Articles.js b/src/pages/List/Articles.js index 0aec03c841d0a1c5b9423d11d35be7e1a93f846d..815e79cc47bf847578eb10851d576b66d5b08a74 100644 --- a/src/pages/List/Articles.js +++ b/src/pages/List/Articles.js @@ -19,7 +19,13 @@ const pageSize = 5; })) class SearchList extends Component { componentDidMount() { - this.fetchMore(); + const { dispatch } = this.props; + dispatch({ + type: 'list/fetch', + payload: { + count: 5, + }, + }); } setOwner = () => {