diff --git a/frontend/pages/admin/families/[id]/comments.vue b/frontend/pages/admin/families/[id]/comments.vue index ddc4440..c52e01b 100644 --- a/frontend/pages/admin/families/[id]/comments.vue +++ b/frontend/pages/admin/families/[id]/comments.vue @@ -23,6 +23,9 @@ definePageMeta({ layout: 'admin-ui', }) +if (!state.is_admin) + navigateTo('/admin/home') + const id = useRoute().params.id as string const fetchedFamily = await state.client.getFamily(id) diff --git a/frontend/pages/admin/families/[id]/entities.vue b/frontend/pages/admin/families/[id]/entities.vue index 4d3780f..e9f73d4 100644 --- a/frontend/pages/admin/families/[id]/entities.vue +++ b/frontend/pages/admin/families/[id]/entities.vue @@ -43,6 +43,9 @@ definePageMeta({ layout: 'admin-ui', }) +if (!state.is_admin) + navigateTo('/admin/home') + const id = useRoute().params.id as string const fetchedFamily = await state.client.getFamily(id) diff --git a/frontend/pages/admin/families/[id]/general.vue b/frontend/pages/admin/families/[id]/general.vue index f180879..d3c1227 100644 --- a/frontend/pages/admin/families/[id]/general.vue +++ b/frontend/pages/admin/families/[id]/general.vue @@ -82,6 +82,9 @@ definePageMeta({ layout: 'admin-ui', }) +if (!state.is_admin) + navigateTo('/admin/home') + const id = useRoute().params.id as string const fetchedFamily = await state.client.getFamily(id) diff --git a/frontend/pages/admin/families/index.vue b/frontend/pages/admin/families/index.vue index 7b718f1..9119fa8 100644 --- a/frontend/pages/admin/families/index.vue +++ b/frontend/pages/admin/families/index.vue @@ -123,14 +123,16 @@ const initAdminLayout = inject('initAdminLayout')! initAdminLayout( 'Familles', 'family', - [ - { - icon: 'add', - label: 'Nouvelle famille', - severity: 'success', - url: `/admin/families/new`, - }, - ], + state.is_admin + ? [ + { + icon: 'add', + label: 'Nouvelle famille', + severity: 'success', + url: `/admin/families/new`, + }, + ] + : [], [ { label: 'Familles', url: '/admin/families' }, ], diff --git a/frontend/pages/admin/families/new-icon-[id].vue b/frontend/pages/admin/families/new-icon-[id].vue index 5e4354c..7cace31 100644 --- a/frontend/pages/admin/families/new-icon-[id].vue +++ b/frontend/pages/admin/families/new-icon-[id].vue @@ -25,6 +25,9 @@ definePageMeta({ layout: 'admin-ui', }) +if (!state.is_admin) + navigateTo('/admin/home') + const id = useRoute().params.id as string const fetchedFamily = await state.fetchFamily(id) diff --git a/frontend/pages/admin/families/new.vue b/frontend/pages/admin/families/new.vue index 98b443b..7142cce 100644 --- a/frontend/pages/admin/families/new.vue +++ b/frontend/pages/admin/families/new.vue @@ -59,6 +59,9 @@ definePageMeta({ layout: 'admin-ui', }) +if (!state.is_admin) + navigateTo('/admin/home') + if (state.families == undefined) await state.fetchFamilies() diff --git a/frontend/pages/admin/users/[id].vue b/frontend/pages/admin/users/[id].vue index 2d41c2e..3663321 100644 --- a/frontend/pages/admin/users/[id].vue +++ b/frontend/pages/admin/users/[id].vue @@ -79,6 +79,9 @@ import type { NewOrUpdatedUser } from '~/lib' import state from '~/lib/admin-state' import { isValidText } from '~/lib/validation' +if (!state.is_admin) + navigateTo('/admin/home') + const userId = useRoute().params.id as string const isNew = (userId === 'new') diff --git a/frontend/pages/admin/users/index.vue b/frontend/pages/admin/users/index.vue index 560d5bb..5fc7834 100644 --- a/frontend/pages/admin/users/index.vue +++ b/frontend/pages/admin/users/index.vue @@ -111,6 +111,9 @@ definePageMeta({ layout: 'admin-ui', }) +if (!state.is_admin) + navigateTo('/admin/home') + const initAdminLayout = inject('initAdminLayout')! initAdminLayout( 'Utilisateurâ‹…ices',