Same Redux vs fetch queries return different result

Viewed 11

Has anyone worked with Redux? I'm running the same query with Redux and with fetch, but getting different results. Basically I need to download the file.

Redux:

Query config:

downloadReport: builder.mutation({
  query: (body) => ({
    url: paths.downloadReport,
    method: "POST",
    body: body,
  }),
}),

return underfined

Fetch:

Fetch config:

  return fetch(`/api/reports/download-report`, {
                 headers: new Headers({'content-type': 'application/json'}),
                 method: "POST",
                 body: JSON.stringify(selectedObj),
  }).then(downloadFile)};

return:

response: Response
body: ReadableStream
bodyUsed: false
headers: Headers {}
ok: true
redirected: false
status: 200
statusText: "OK"
type: "basic"
url: "http://localhost:3000/api/reports/download-report"

How can I make Redux work like fetch ?

0 Answers
Related