提交 69a9d9bb 编写于 作者: 陈帅 提交者: niko

Unlimited list to add a special method (#451)

上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册