Browse Source

Unlimited list to add a special method (#451)

pull/454/merge
陈帅 9 years ago
committed by niko
parent
commit
69a9d9bb3a
  1. 21
      src/models/list.js
  2. 2
      src/routes/List/SearchList.js

21
src/models/list.js

@ -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,

2
src/routes/List/SearchList.js

@ -32,7 +32,7 @@ export default class SearchList extends Component {
fetchMore = () => {
this.props.dispatch({
type: 'list/fetch',
type: 'list/appendFetch',
payload: {
count: pageSize,
},

Loading…
Cancel
Save