kennethjiang / js-file-download

MIT License
918 stars 119 forks source link

getting undefined filename #73

Closed mrpbennett closed 3 years ago

mrpbennett commented 3 years ago

Any idea why i am getting undefined when downloading the file as the file name?

const downloadGPX = () => {
    axios({
      method: 'GET',
      url: `https://www.strava.com/api/v3/routes/${props.data.contentfulRoutes.slug}/export_gpx`,
      headers: { Authorization: `Bearer ${stoken}` },
      responseType: 'blob',
    })
      .then((response) => {
        console.log(response.data);
        fileDownload((response.data, `${route.name}.gpx`));
      })
      .catch((err) => {
        console.log(err);
      });
  };

The ${route.name}.gpx is the contents of the file