real-boxses exel download

This commit is contained in:
Samandar Turg'unboev
2025-05-26 13:36:53 +05:00
parent ce2b8f3a62
commit ca60c5bdcc
2 changed files with 2 additions and 2 deletions

View File

@@ -31,7 +31,7 @@ export const real_box_requests = {
return request.delete<CommonResponseType>('/boxes/delete', { params }); return request.delete<CommonResponseType>('/boxes/delete', { params });
}, },
async downloadExcel(params: { boxId: number | string }) { async downloadExcel(params: { boxId: number | string }) {
return request.get<Blob>(`/boxes/download/`, { params }); return request.get<Blob>(`/boxes/download/${params.boxId}`);
}, },
async downloadQrCode(params: { boxId: number | string }) { async downloadQrCode(params: { boxId: number | string }) {
return request.get(`/qr/${params.boxId}`, { responseType: 'blob' }); return request.get(`/qr/${params.boxId}`, { responseType: 'blob' });

View File

@@ -120,7 +120,7 @@ const DashboardRealBoxesPage = (props: Props) => {
try { try {
setDownloadIds(p => [...p, id]); setDownloadIds(p => [...p, id]);
const response = await real_box_requests.downloadExcel({ boxId: id }); const response = await real_box_requests.downloadExcel({ boxId: id });
const file = new File([response.data], 'Box-excel.xlsx', { type: response.data.type }); const file = new File([response.data], 'Boxses-excel.xlsx', { type: response.data.type });
file_service.download(file); file_service.download(file);
} catch (error) { } catch (error) {
notifyUnknownError(error); notifyUnknownError(error);