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