-
Notifications
You must be signed in to change notification settings - Fork 2
[WIP] User roles #38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[WIP] User roles #38
Conversation
| else { | ||
| throw createError({ | ||
| statusCode: 401, | ||
| statusMessage: "Unauthorized", | ||
| }); | ||
| } | ||
| if (!userRoles.includes("admin")) { | ||
| throw createError({ | ||
| statusCode: 403, | ||
| statusMessage: "Forbidden", | ||
| }); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think these will work correctly when using client-side only rendering, we should probably use middleware instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tested this by adding ssr: false to nuxt.config.ts and the page appears to render fine client-only (for both logged in and non-logged in with the errors). I can't find anything online or in the docs about this being an issue.
https://nuxt.com/docs/4.x/getting-started/error-handling#createerror
I'll leave this unresolved until I've done more research and testing and will come back to it
Also added POST for roles, not in use yet though
UI is functional but very ugly, holding off on fleshing this out until I know what all the page content will be
Changes made
Will add more PR detail closer to completion, just throwing this up for visibility in case anything fundamental needs changed early on.
Screenshots
When logged in as admin:



When not logged in (similar if logged in as non-admin, but shows 403 forbidden instead):
