onClick I want to download the csv files, with queryparam and if download fails due to wrong params want to display popup message
Here is my onClick doSubmit method,
const doSubmit = () => {
let timeZoneoffset = new Date().getTimezoneOffset();
let location = `${apiEndpoint}/export-device-data?fromDate=${fromDateTime}&toDate=${toDateTime}&userId=${values.userId}&deviceTypeId=${deviceId}&timeZoneoffset=${timeZoneoffset}`;
window.open(location, '_blank');
};
with the above code I am able to download the csv file if I pass the correct params values. But when I pass the incorrect params values getting error object in new tab:
{"status":false,"responseCode":400,"message":"Invalid Request"}