diff --git a/src/routes/private/real-boxes/DashboardRealBoxesPage.tsx b/src/routes/private/real-boxes/DashboardRealBoxesPage.tsx index 5f75960..cb31550 100644 --- a/src/routes/private/real-boxes/DashboardRealBoxesPage.tsx +++ b/src/routes/private/real-boxes/DashboardRealBoxesPage.tsx @@ -114,13 +114,13 @@ const DashboardRealBoxesPage = (props: Props) => { } }; - const onDownloadExcel = async (id: number) => { + const onDownloadExcel = async (id: number, name: string) => { if (downloadIds.includes(id)) return; try { setDownloadIds(p => [...p, id]); - const response = await real_box_requests.downloadExcel({ boxId: id }); - const file = new File([response.data], 'Boxses-excel.xlsx', { type: response.data.type }); + const response = await real_box_requests.downloadExcel({ boxId: id }); + const file = new File([response.data], `${name}.xlsx`, { type: response.data.type }); file_service.download(file); } catch (error) { notifyUnknownError(error); @@ -325,7 +325,7 @@ const DashboardRealBoxesPage = (props: Props) => { icon: , label: t('download_excel'), onClick: () => { - onDownloadExcel(data.id); + onDownloadExcel(data.id, data.boxName); }, loading: downloadIds.includes(data.id), dontCloseOnClick: true,