change button in instructor manager dashboard
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user