Browse Source

filename check null

master
Anna Ho 1 year ago
parent
commit
b426a9ea19
2 changed files with 10 additions and 8 deletions
  1. +5
    -4
      src/pages/PublicNotice/Details_GLD/ApplicationDetailCard.js
  2. +5
    -4
      src/pages/PublicNotice/Details_Public/ApplicationDetailCard.js

+ 5
- 4
src/pages/PublicNotice/Details_GLD/ApplicationDetailCard.js View File

@@ -75,9 +75,9 @@ const ApplicationDetailCard = (


const onDownloadClick = () => () => { const onDownloadClick = () => () => {
HttpUtils.fileDownload({ HttpUtils.fileDownload({
fileId: fileDetail.id,
skey: fileDetail.skey,
filename: fileDetail.filename,
fileId: fileDetail?.id,
skey: fileDetail?.skey,
filename: fileDetail?.filename,
}); });
notifyDownloadSuccess() notifyDownloadSuccess()
setUploadStatus(true) setUploadStatus(true)
@@ -510,7 +510,7 @@ const ApplicationDetailCard = (
variant="h5" variant="h5"
sx={{ wordBreak: 'break-word' }} sx={{ wordBreak: 'break-word' }}
> >
{fileDetail.filename}
{fileDetail?.filename}
</Typography> </Typography>
</FormControl> </FormControl>
</Grid> </Grid>
@@ -519,6 +519,7 @@ const ApplicationDetailCard = (
size="small" size="small"
variant="contained" variant="contained"
onClick={onDownloadClick()} onClick={onDownloadClick()}
disabled={!fileDetail?.filename}
sx={{ sx={{
textTransform: 'capitalize', textTransform: 'capitalize',
alignItems: 'end', alignItems: 'end',


+ 5
- 4
src/pages/PublicNotice/Details_Public/ApplicationDetailCard.js View File

@@ -95,9 +95,9 @@ const ApplicationDetailCard = (


const onDownloadClick = () => () => { const onDownloadClick = () => () => {
HttpUtils.fileDownload({ HttpUtils.fileDownload({
fileId: fileDetail.id,
skey: fileDetail.skey,
filename: fileDetail.filename,
fileId: fileDetail?.id,
skey: fileDetail?.skey,
filename: fileDetail?.filename,
}); });
}; };


@@ -537,7 +537,7 @@ const ApplicationDetailCard = (
id='fileName' id='fileName'
variant="pnspsFormParagraph" variant="pnspsFormParagraph"
> >
{fileDetail.filename}
{fileDetail?.filename}
</Typography> </Typography>
<ThemeProvider theme={PNSPS_BUTTON_THEME}> <ThemeProvider theme={PNSPS_BUTTON_THEME}>
<Button <Button
@@ -547,6 +547,7 @@ const ApplicationDetailCard = (
aria-label={intl.formatMessage({ id: 'download' })} aria-label={intl.formatMessage({ id: 'download' })}
title={intl.formatMessage({ id: 'download' })} title={intl.formatMessage({ id: 'download' })}
color="save" color="save"
disabled={!fileDetail?.filename}
startIcon={<DownloadIcon sx={{ alignItems: "center" }} />} startIcon={<DownloadIcon sx={{ alignItems: "center" }} />}
> >
<FormattedMessage id="download" /> <FormattedMessage id="download" />


Loading…
Cancel
Save