zoukankan      html  css  js  c++  java
  • xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

    redux & dispatch & payload

    react & react-redux & redux-saga

    
        // contrast
        dispatch({
          type: "pointCheckDetail/getContrastData",
          payload: {
            id,
          },
        });
        // status
        dispatch({
          type: "pointCheckDetail/getPointCheckResults",
          payload: {},
        });
        // table
        dispatch({
          type: "pointCheckDetail/getPointCheckDetails",
          payload: {
            id,
            contrasts,
          },
        });
    
    
    
      effects: {
        *initData({ payload }, { put }) {
          yield put({
            type: "save",
            payload: {
              ...initialState,
              ...payload,
            }
          });
        },
        *getBasicData({ payload }, { put, call }) {
          yield put({
            type: "showLoading",
          });
          const {
            id,
          } = payload;
          const res = yield call(getPointCheckBasics, id);
          if (res.success) {
            yield put({
              type: "save",
              payload: {
                loading: false,
                // dataSource: res.data,
              },
            });
          } else {
            yield put({
              type: "hiddenLoading",
            });
            message.error(`获取数据失败!`);
          }
        },
        *getContrastData({ payload }, { put, call }) {
          yield put({
            type: "showLoading",
          });
          const {
            id,
          } = payload;
          const res = yield call(getPointCheckContrasts, id);
          if (res.success) {
            yield put({
              type: "save",
              payload: {
                loading: false,
                // contrast: contrastShaper(res.data),
                contrast: contrastShaper([]),
              },
            });
          } else {
            yield put({
              type: "hiddenLoading",
            });
            message.error(`获取数据失败!`);
          }
        },
        *getResultData({}, { put, call }) {
          yield put({
            type: "showLoading",
          });
          const res = yield call(getPointCheckResults, );
          if (res.success) {
            yield put({
              type: "save",
              payload: {
                loading: false,
                // dataSource: res.data,
              },
            });
          } else {
            yield put({
              type: "hiddenLoading",
            });
            message.error(`获取数据失败!`);
          }
        },
        *updateReportName({ payload }, { put, call }) {
          yield put({
            type: "showLoading",
          });
          // const {
          //   id,
          //   name,
          // } = payload;
          const res = yield call(putPointCheckReportName, payload);
          if (res.success) {
            yield put({
              type: "save",
              payload: {
                loading: false,
                // dataSource: res.data,
              },
            });
          } else {
            yield put({
              type: "hiddenLoading",
            });
            message.error(`获取数据失败!`);
          }
        },
        *getTableData({ payload }, { put, call }) {
          yield put({
            type: "showLoading",
          });
          // const {
          //   id,
          //   contrasts,
          // } = payload;
          const res = yield call(getPointCheckDetails, payload);
          if (res.success) {
            yield put({
              type: "save",
              payload: {
                loading: false,
                // dataSource: res.data,
              },
            });
          } else {
            yield put({
              type: "hiddenLoading",
            });
            message.error(`获取数据失败!`);
          }
        },
      },
    
    
    
    

    refs

    https://zzk.cnblogs.com/my/s/blogpost-p?Keywords=redux-saga



    ©xgqfrms 2012-2020

    www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!


  • 相关阅读:
    Firefox常用插件
    给创业者的提醒
    Visual Studio 2005插件开发官方Demo下载
    Windows Media Player Firefox Plugin支持Server 2003
    【转】C++的64位整数
    【转】C++成员函数的内存分配问题
    【转】C++类的实例分布
    【转】 IntelliJ Idea 常用快捷键列表
    程序员必备神器
    程序员必备神器
  • 原文地址:https://www.cnblogs.com/xgqfrms/p/11589370.html
Copyright © 2011-2022 走看看