Files
leim-tools/pages/calendars/[id].vue
Alexis 535a73162c Added user change validation and read status
This might be better to just refetch the data with anonymous authorizations
2024-12-17 17:17:13 +01:00

38 lines
1.3 KiB
Vue

<script lang="ts" setup>
import { PhCircleNotch } from "@phosphor-icons/vue";
import type { Calendar } from "~/models/CalendarConfig";
import type { Category } from "~/models/Category";
const route = useRoute()
const shortId = route.params.id
const { data: calendarData, pending: calPending } = await useLazyFetch("/api/calendars/query", { key: `calendar-${shortId}`, query: { shortId, full: true } })
const { data: catData, pending: catPending } = await useLazyFetch("/api/calendars/categories/query", { key: `categories-${shortId}` })
const cal = computed<Calendar>(() => calendarData?.value?.data as Calendar)
const categories = computed<Category[]>(() => catData?.value?.data as Category[])
</script>
<template>
<div v-if="calPending || catPending" class="h-full w-full grid place-items-center">
<Head>
<Title>{{ $t("entity.calendar.nameSingular") }}</Title>
</Head>
<div class="grid gap-2 justify-items-center opacity-50">
<p>
{{ $t('entity.calendar.isLoading') }}
</p>
<PhCircleNotch size="50" class="animate-spin"/>
</div>
</div>
<div v-else-if="cal && categories" class="h-full w-full">
<Head>
<Title>{{ cal.name }}</Title>
</Head>
<Calendar :calendar-data="cal" :categories />
</div>
</template>