I get the file name from the content-disposition object in the response header, but typescript gives an error. Cannot invoke an object which is possibly 'null' or 'undefined'.ts(2723)
const filename = response.headers.get('content-disposition')?.split('"')[1] || 'file';
Also this didnt work
const filename = response?.headers?.get('content-disposition')?.split('"')[1] || 'file';
Thanks for helping.
In axios, you just do this: response?.headers['content-disposition']