From 19f545f16161679f4280f0223bb888ef553a9d93 Mon Sep 17 00:00:00 2001 From: onmax Date: Thu, 3 Oct 2024 17:31:44 +0200 Subject: [PATCH] chore: useRouteQuery --- app/pages/[parent]/[uid].vue | 7 ++----- app/pages/[uid].vue | 7 ++----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/app/pages/[parent]/[uid].vue b/app/pages/[parent]/[uid].vue index d8c9b7ae..efd71617 100644 --- a/app/pages/[parent]/[uid].vue +++ b/app/pages/[parent]/[uid].vue @@ -2,13 +2,10 @@ import type { Content } from '@prismicio/client' import { components } from '~/slices' -const route = useRoute() - -// @ts-expect-error - `uid` is defined -const uid = route.params.uid +const uid = useRouteQuery('uid') // TODO CHange to usePrismic -const { data: page } = usePrismicDocumentByUID('child_page', uid) +const { data: page } = usePrismicDocumentByUID('child_page', uid.value as string) useHead({ title: page.value?.data.meta_title, diff --git a/app/pages/[uid].vue b/app/pages/[uid].vue index dcb10d3c..e3565b4e 100644 --- a/app/pages/[uid].vue +++ b/app/pages/[uid].vue @@ -2,13 +2,10 @@ import type { Content } from '@prismicio/client' import { components } from '~/slices' -const route = useRoute() - -// @ts-expect-error - `uid` is defined -const uid = route.params.uid +const uid = useRouteQuery('uid') // TODO CHange to usePrismic -const { data: page } = usePrismicDocumentByUID('page', uid) +const { data: page } = usePrismicDocumentByUID('page', uid.value as string) useHead({ title: page.value?.data.meta_title,