Dependency cleanup
This commit is contained in:
parent
2d892779bf
commit
2568547384
28 changed files with 170 additions and 482 deletions
|
|
@ -61,7 +61,8 @@ export default withAuth(checkRewrites, {
|
|||
},
|
||||
callbacks: {
|
||||
authorized: ({ token, req }) => {
|
||||
if (req.nextUrl.pathname.startsWith("/api/v1/")) {
|
||||
const path = req.nextUrl.pathname;
|
||||
if (path.startsWith("/api/v1/")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -70,6 +71,11 @@ export default withAuth(checkRewrites, {
|
|||
}
|
||||
|
||||
const roles: any = token?.roles ?? [];
|
||||
|
||||
if (path.startsWith("/admin") && !roles.includes("admin")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (roles.includes("admin") || roles.includes("agent")) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue