change button in instructor manager dashboard

This commit is contained in:
Noemi
2025-07-02 10:06:11 +02:00
parent f9e6d227d3
commit b140e0e688

View File

@@ -130,21 +130,20 @@ const LatestBandiTableInstructorManagerAsync = () => {
size="small"
icon="pi pi-receipt"
iconPos="right"
label={__('CSV', 'gepafin')}
onClick={() => exportToCSV(rowData.id)}/>
label={__('Scarica graduatoria', 'gepafin')}
onClick={() => handleDownloadRanking(rowData.id)}
/>
</div>
}
const exportToCSV = (applicationId) => {
const handleDownloadRanking = (callId) => {
setLocalAsyncRequest(true);
ApplicationService.downloadCsvReport(
applicationId,
(resp) => getCsvReportback(resp, applicationId),
errCsvReportCallback
)
ApplicationService.downloadRanking(callId,
(resp) => downloadSuccessCallback(resp, callId),
downloadErrorCallback)
}
const getCsvReportback = (resp, applicationId) => {
const downloadSuccessCallback = (resp, applicationId) => {
const file = new Blob([resp], { type: 'text/csv' });
const url = window.URL.createObjectURL(file);
const link = document.createElement('a');
@@ -156,7 +155,7 @@ const LatestBandiTableInstructorManagerAsync = () => {
setLocalAsyncRequest(false);
}
const errCsvReportCallback = (resp) => {
const downloadErrorCallback = (resp) => {
set404FromErrorResponse(resp);
setLocalAsyncRequest(false);
}