Added auth guard middleware

This commit is contained in:
Alexis
2024-05-14 12:07:05 +02:00
parent cd5822def4
commit f77950b5be
2 changed files with 19 additions and 0 deletions

View File

@@ -1,10 +1,22 @@
<script lang="ts" setup>
import type { MenuItem } from '~/components/global/SidebarProps';
const user = useSupabaseUser()
useHead({
title: 'Profil'
})
definePageMeta({
middleware: ['auth-guard']
})
// Redirect user back home when they log out on the page
watch(user, (n, _o) => {
if (!n) {
navigateTo('/')
}
})
const sidebarMenu: MenuItem[] = []
</script>