There is an API endpoint which offers a downloadable file - when accessing the url directly from the browser - the file is saved automatically. However, I would like to target the given endpoint from my app, and fetch the file name and content to a reducer within my app's redux store.
I'm using axios
for all API requests. In this case, I'm trying to do it like this:
axios({
url: API_ENDPOINT_URL,
method: "GET",
headers,
}).then((response) => {
// do some stuff
console.log("response ", response)
})
In this setup, response
contains only data
, there is no filename. How to go about this?