1

我有以下情况:

  1. 单击下载合同按钮时发送带有合同 ID 作为有效负载的 API 请求
  2. 获取 API 响应中的 pdfBuffer 字段
  3. 有一个可以将pdfButtfer转换为pdf文件的功能A

在 index.js 下的 Actions

export const fetchContract = contractId => {
  return dispatch => {
    axios
      .post('/view-contract', { contractId: contractId })
      .then(res => {
        const pdfBuffer = res.data.pdfBuffer
      })
      .catch((err) => console.log(err));
  };
};

我们可以直接调用Actions 文件夹下 index.js 中的函数 A还是需要将 pdfBuffer 分派到 reducer 并从连接到 redux 存储的容器组件中获取 pdfBuffer,然后在容器组件级别调用函数 A ?

请指教。多谢。

4

0 回答 0