Fixed short id calendar page data
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { PhArrowBendDoubleUpLeft, PhCalendarX, PhCircleNotch } from "@phosphor-icons/vue";
|
import { PhArrowBendDoubleUpLeft, PhCalendarX, PhCircleNotch } from "@phosphor-icons/vue";
|
||||||
import type { Calendar } from "~/models/CalendarConfig";
|
import type { Calendar } from "~/models/CalendarConfig";
|
||||||
import type { Category } from "~/models/Category";
|
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const shortId = route.params.id
|
const shortId = route.params.id
|
||||||
@@ -22,25 +21,14 @@ const {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
const {
|
const isLoading = computed(() => calendarStatus.value === "pending")
|
||||||
data: categories,
|
|
||||||
status: categoriesStatus,
|
|
||||||
refresh: catRefresh
|
|
||||||
} = await useLazyFetch<{ data: Category[] }>("/api/calendars/categories/query",
|
|
||||||
{ key: "active-categories" }
|
|
||||||
)
|
|
||||||
|
|
||||||
const isLoading = computed(() => calendarStatus.value === "pending" || categoriesStatus.value === "pending")
|
watch(user, () => calRefresh())
|
||||||
|
|
||||||
watch(user, () => {
|
|
||||||
calRefresh()
|
|
||||||
catRefresh()
|
|
||||||
})
|
|
||||||
|
|
||||||
const { setActiveCalendar } = useCalendar()
|
const { setActiveCalendar } = useCalendar()
|
||||||
watch(isLoading, (n) => {
|
watch(isLoading, (n) => {
|
||||||
if (!n && calendar.value?.data && categories.value?.data) {
|
if (!n && calendar.value?.data) {
|
||||||
setActiveCalendar(calendar.value?.data, categories.value.data)
|
setActiveCalendar(calendar.value?.data)
|
||||||
}
|
}
|
||||||
}, { immediate: true }
|
}, { immediate: true }
|
||||||
)
|
)
|
||||||
@@ -60,7 +48,7 @@ watch(isLoading, (n) => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-else-if="calendar?.data && categories?.data" class="h-full w-full pt-8">
|
<div v-else-if="calendar?.data" class="h-full w-full pt-8">
|
||||||
<Head>
|
<Head>
|
||||||
<Title>{{ calendar.data.name }}</Title>
|
<Title>{{ calendar.data.name }}</Title>
|
||||||
</Head>
|
</Head>
|
||||||
|
|||||||
Reference in New Issue
Block a user