Refactored user menu and titles

This commit is contained in:
Alexis
2024-08-25 18:24:59 +02:00
parent 8b1eb9c258
commit 3f201b90e3
5 changed files with 105 additions and 40 deletions

View File

@@ -3,9 +3,6 @@ import { PhCircleNotch } from "@phosphor-icons/vue";
import type { Calendar } from "~/models/CalendarConfig";
import type { Category } from "~/models/Category";
useHead({
title: "Calendrier"
})
definePageMeta({
middleware: ["auth-guard"]
})
@@ -21,11 +18,15 @@ watch(user, (n) => {
const route = useRoute()
const id = route.params.id
const { data: calendarData, pending: calPending } = useLazyFetch("/api/calendars/query", { key: `calendar-${id}`, query: { id, full: true } })
const { data: catData, pending: catPending } = useLazyFetch("/api/calendars/categories/query", { key: `categories-${id}` })
const { data: calendarData, pending: calPending } = await useLazyFetch("/api/calendars/query", { key: `calendar-${id}`, query: { id, full: true } })
const { data: catData, pending: catPending } = await useLazyFetch("/api/calendars/categories/query", { key: `categories-${id}` })
const cal = computed<Calendar>(() => calendarData?.value?.data as Calendar)
const categories = computed<Category[]>(() => catData?.value?.data as Category[])
useHead({
title: cal.value.name
})
</script>
<template>