import { queryTopicList } from '@/services/topic';
export default {
namespace: 'topic',
state: {
topicList: [],
},
effects: {
*queryTopicList({ payload }, { call, put }) {
const response = yield call(queryTopicList, payload);
if (response.code === 0) {
yield put({
type: 'saveTopicList',
payload: {
data: response,
},
});
} else {
// eslint-disable-next-line no-console
console.log('request failed');
}
},
},
reducers: {
saveTopicList(state, action) {
return {
...state,
};
},
},
};
网友评论