All files / apps/huella-legal/layers/reading/app/composables usePage.ts

100% Statements 12/12
100% Branches 4/4
100% Functions 5/5
100% Lines 11/11

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 193x 6x   6x 6x   6x 3x 1x 2x     6x   6x   5x    
export const usePage = async () => {
    const route = useRoute("article");
 
    const request = useCachedFetch<Page>(`/api/pages/${route.params.slug}`);
    const { data: page } = request;
 
    useSeoMeta({
        title: () => page.value?.seo?.title ?? page.value?.title,
        description: () => page.value?.seo?.description,
        robots: () => (page.value?.seo?.noindex ? "noindex" : undefined),
    });
 
    useSeoTitleTemplate(() => page.value?.seo?.title);
 
    await useFailOnError(request);
 
    return { page };
};