Skip to content
Snippets Groups Projects
Commit fd8671db authored by Erik Borgeteien Hansen's avatar Erik Borgeteien Hansen
Browse files

add admin guard route

parent 865eb924
Branches
No related tags found
1 merge request!128Admin page guard
......@@ -15,6 +15,12 @@ function guardRoute(to, from, next) {
}
}
function isAdmin(to, from, next) {
if (store.state.user.adminList.includes(parseInt(from.params.communityID)))
next();
else next("/");
}
const routes = [
{
path: "/",
......@@ -114,7 +120,7 @@ const routes = [
path: "/community/:communityID/admin",
name: "CommunityAdminView",
component: () => import("@/views/CommunityViews/AdminView.vue"),
beforeEnter: guardRoute,
beforeEnter: isAdmin,
},
{
path: "/itempage/:id",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment