美文网首页
umi.js model模板

umi.js model模板

作者: wsj_2012 | 来源:发表于2019-11-25 14:11 被阅读0次
    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,
          };
        },
      },
    };
    
    

    相关文章

      网友评论

          本文标题:umi.js model模板

          本文链接:https://www.haomeiwen.com/subject/readwctx.html