Skip to content

Commit bf33d63

Browse files
committed
reorder access check
1 parent 6fb5d99 commit bf33d63

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

src/client/components/Errors/Unauthorized.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
import { useNavigate } from 'react-router-dom'
2-
import { Box, Button, Container, Typography } from '@mui/material'
1+
import { Box, Container, Typography } from '@mui/material'
32

43
const Unauthorized = () => {
5-
const navigate = useNavigate()
6-
74
return (
85
<Box
96
sx={{
@@ -13,12 +10,9 @@ const Unauthorized = () => {
1310
>
1411
<Container>
1512
<Typography variant="h2" sx={{ my: 4, fontWeight: 'bold' }}>
16-
UNAUTHORIZED (401)
13+
UNAUTHORIZED
1714
</Typography>
1815
<Typography variant="h6">Sorry, but you do not have the needed access to this page.</Typography>
19-
<Button sx={{ mt: 4 }} variant="contained" onClick={() => navigate('/')}>
20-
Back Home
21-
</Button>
2216
</Container>
2317
</Box>
2418
)

src/server/routes/index.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,18 @@ router.post('/seed', adminHandler, async (_, res) => {
6060

6161
router.use('/login', loginRouter)
6262

63-
router.use(userAccessMiddleware)
64-
6563
router.use('/faculties', facultyRouter)
6664
router.use('/surveys', surveyRouter)
6765
router.use('/questions', questionRouter)
6866
router.use('/results', resultRouter)
69-
router.use('/entries', entryRouter)
70-
router.use('/users', userRouter)
7167
router.use('/countries', countryRouter)
72-
router.use('/organizations', organizationRouter)
7368
router.use('/warnings', warningsRouter)
69+
70+
router.use(userAccessMiddleware)
71+
72+
router.use('/users', userRouter)
73+
router.use('/entries', entryRouter)
74+
router.use('/organizations', organizationRouter)
7475
router.use('/tuhatprojects', tuhatProjectsRouter)
7576
router.use('/riskiapi', myResearchApiRouter)
7677

0 commit comments

Comments
 (0)