Files
ui/docs/error.vue
2023-09-15 14:37:53 +02:00

53 lines
1.1 KiB
Vue

<template>
<div>
<Header />
<UContainer>
<UMain>
<UPage>
<UPageError :error="error" />
</UPage>
</UMain>
</UContainer>
<ClientOnly>
<LazyUDocsSearch :files="files" :navigation="navigation" />
</ClientOnly>
<UNotifications />
</div>
</template>
<script setup lang="ts">
import type { NuxtError } from '#app'
import type { ParsedContent } from '@nuxt/content/dist/runtime/types'
useSeoMeta({
title: 'Page not found',
description: 'We are sorry but this page could not be found.'
})
defineProps<{
error: NuxtError
}>()
const { branch } = useContentSource()
const { data: nav } = await useAsyncData('navigation', () => fetchContentNavigation())
const { data: files } = useLazyFetch<ParsedContent[]>('/api/search.json', { default: () => [], server: false })
// Computed
const navigation = computed(() => {
const main = nav.value.filter(item => item._path !== '/dev')
const dev = nav.value.find(item => item._path === '/dev')?.children
return branch.value?.name === 'dev' ? dev : main
})
// Provide
provide('navigation', navigation)
provide('files', files)
</script>