Refactored the store system

This commit is contained in:
Alexis
2024-08-20 09:15:05 +02:00
parent 7244120219
commit e978acfc71
26 changed files with 446 additions and 240 deletions

26
pages/i/calendar/[id].vue Normal file
View File

@@ -0,0 +1,26 @@
<script lang="ts" setup>
useHead({
title: 'Calendrier'
})
definePageMeta({
middleware: ['auth-guard']
})
const user = useSupabaseUser()
// Redirect user back home when they log out on the page
watch(user, (n, _o) => {
if (!n) {
navigateTo('/')
}
})
const route = useRoute()
const id = route.params.id
const calendarStore = useCalendar()
const { pending: calendarPending } = await useAsyncData('calendar', () => calendarStore.fetchCalendar(Number(id)).then(() => true))
</script>
<template>
<Calendar v-if="!calendarPending" />
</template>