|
|
@ -75,8 +75,10 @@ export default defineNuxtRouteMiddleware(async (to, from) => { |
|
|
|
/** if users are accessing the projects without having enough permissions, redirect to My Projects page */ |
|
|
|
/** if users are accessing the projects without having enough permissions, redirect to My Projects page */ |
|
|
|
if (to.params.projectId && from.params.projectId !== to.params.projectId) { |
|
|
|
if (to.params.projectId && from.params.projectId !== to.params.projectId) { |
|
|
|
const user = await api.auth.me({ project_id: to?.params?.projectId as string }) |
|
|
|
const user = await api.auth.me({ project_id: to?.params?.projectId as string }) |
|
|
|
|
|
|
|
|
|
|
|
if (user?.roles?.user) { |
|
|
|
if (user?.roles?.user) { |
|
|
|
message.error("You don't have enough permission to access the project.") |
|
|
|
message.error("You don't have enough permission to access the project.") |
|
|
|
|
|
|
|
|
|
|
|
return navigateTo('/') |
|
|
|
return navigateTo('/') |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|