(fix) 存在しないDocsにクライアント遷移した際にエラー画面が出るように

This commit is contained in:
kakkokari-gtyih 2023-12-13 23:34:26 +09:00
parent 60dee6c133
commit c471c53497
3 changed files with 3 additions and 3 deletions

View File

@ -69,7 +69,7 @@ const runtimeConfig = useRuntimeConfig();
const { data } = await useAsyncData(`blog-${route.params.slug}`, () => queryContent<MiBlogParsedContent>(`/blog/${route.params.slug}`).findOne());
if (!data.value) {
throw createError({ statusCode: 404, statusMessage: 'page not found' });
throw createError({ statusCode: 404, statusMessage: 'page not found', fatal: true });
}
const thumbnail = !data.value.thumbnail ? undefined : (parseURL(data.value.thumbnail).host == null) ? joinURL(runtimeConfig.public.baseUrl, data.value.thumbnail) : data.value.thumbnail;

View File

@ -66,7 +66,7 @@ const slugs = (route.params.slug as string[]).filter((v) => v !== '');
const { data } = await useAsyncData(`docs-${locale.value}-${slugs.join('-')}`, () => queryContent<MiDocsParsedContent>(`/${locale.value}/docs/${slugs.join('/')}`).findOne());
if (!data.value) {
throw createError({ statusCode: 404, statusMessage: 'page not found' });
throw createError({ statusCode: 404, statusMessage: 'page not found', fatal: true });
}
route.meta.title = data.value?.title;

View File

@ -39,7 +39,7 @@ const route = useRoute();
const { data } = await useAsyncData('global-ns', () => queryContent(`/ns`).findOne());
if (!data.value) {
throw createError({ statusCode: 404, statusMessage: 'page not found' });
throw createError({ statusCode: 404, statusMessage: 'page not found', fatal: true });
}
route.meta.title = data.value?.title;