Skip to content

Commit 06c5785

Browse files
committed
fix bug
1 parent 0063c97 commit 06c5785

File tree

1 file changed

+37
-30
lines changed

1 file changed

+37
-30
lines changed

src/pages/dash/upload.tsx

Lines changed: 37 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/* eslint-disable @typescript-eslint/ban-ts-comment */
2+
// @ts-nocheck
3+
14
import React from 'react';
25
import { useRouter } from 'next/router';
36
import Typography from '@material-ui/core/Typography';
@@ -60,41 +63,45 @@ export default function Upload() {
6063
}
6164
};
6265

66+
const snack = (
67+
<Snackbar
68+
anchorOrigin={{
69+
vertical: 'top',
70+
horizontal: 'center'
71+
}}
72+
open={alertOpen}
73+
autoHideDuration={6000}
74+
onClose={() => setAlertOpen(false)}
75+
>
76+
<Alert severity={alertSev} variant='filled'>
77+
{alertMsg}
78+
</Alert>
79+
</Snackbar>
80+
);
81+
6382
if (typeof window === 'undefined') return <UIPlaceholder />;
6483
if (!state.loggedIn) router.push('/user/login');
6584
else {
6685
return (
6786
<UI>
68-
<Snackbar
69-
anchorOrigin={{
70-
vertical: 'top',
71-
horizontal: 'center'
72-
}}
73-
open={alertOpen}
74-
autoHideDuration={6000}
75-
onClose={() => setAlertOpen(false)}
76-
>
77-
{/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */}
78-
{/* @ts-ignore */}
79-
<Alert severity={alertSev} variant='filled'>
80-
{alertMsg}
81-
</Alert>
82-
</Snackbar>
83-
<Paper elevation={3} className={classes.padding}>
84-
<Typography variant='h5'>
85-
Upload
86-
</Typography>
87-
<Box m={1}>
88-
<DropzoneArea
89-
acceptedFiles={['image/*']}
90-
dropzoneText={'Drag an image or click to upload an image.'}
91-
onChange={f => setFiles(f)}
92-
filesLimit={1}
93-
maxFileSize={1073741824} // 1gb in byte
94-
/>
95-
</Box>
96-
<Button onClick={handleFileUpload}>Upload</Button>
97-
</Paper>
87+
<>
88+
{snack}
89+
<Paper elevation={3} className={classes.padding}>
90+
<Typography variant='h5'>
91+
Upload
92+
</Typography>
93+
<Box m={1}>
94+
<DropzoneArea
95+
acceptedFiles={['image/*']}
96+
dropzoneText={'Drag an image or click to upload an image.'}
97+
onChange={f => setFiles(f)}
98+
filesLimit={1}
99+
maxFileSize={1073741824} // 1gb in byte
100+
/>
101+
</Box>
102+
<Button onClick={handleFileUpload}>Upload</Button>
103+
</Paper>
104+
</>
98105
</UI>
99106
);
100107
}

0 commit comments

Comments
 (0)