Watched for user change in the page instead
This commit is contained in:
@@ -6,11 +6,18 @@ 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 user = useSupabaseUser()
|
||||
|
||||
const { data: calendarData, pending: calPending, refresh: calRefresh } = await useLazyFetch("/api/calendars/query", { key: `calendar-${shortId}`, query: { shortId, full: true } })
|
||||
const { data: catData, pending: catPending, refresh: catRefresh } = 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[])
|
||||
|
||||
watch(user, () => {
|
||||
calRefresh()
|
||||
catRefresh()
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
Reference in New Issue
Block a user