schedule upload & download feature

This commit is contained in:
Proddy
2023-02-26 12:56:48 +01:00
parent 5927781a6b
commit 0464030544
9 changed files with 44 additions and 13 deletions

View File

@@ -69,6 +69,19 @@ const GeneralFileUpload: FC<UploadFileProps> = ({ uploadGeneralFile }) => {
}
};
const downloadSchedule = async () => {
try {
const response = await EMSESP.readSchedule();
if (response.status !== 200) {
enqueueSnackbar(LL.PROBLEM_LOADING(), { variant: 'error' });
} else {
saveFile(response.data, 'schedule');
}
} catch (error) {
enqueueSnackbar(extractErrorMessage(error, LL.PROBLEM_LOADING()), { variant: 'error' });
}
};
return (
<>
{!uploading && (
@@ -114,6 +127,14 @@ const GeneralFileUpload: FC<UploadFileProps> = ({ uploadGeneralFile }) => {
>
{LL.CUSTOMIZATIONS()}
</Button>
<Box color="warning.main">
<Typography mt={2} mb={1} variant="body2">
{LL.DOWNLOAD_SCHEDULE_TEXT()}{' '}
</Typography>
</Box>
<Button startIcon={<DownloadIcon />} variant="outlined" color="primary" onClick={() => downloadSchedule()}>
{LL.SCHEDULE()}
</Button>
</>
)}
</>