real-boxses exel download
This commit is contained in:
@@ -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' });
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user