Skip to content

Commit

Permalink
chg: useAsyncDataのキーをなくす
Browse files Browse the repository at this point in the history
  • Loading branch information
ashcolor committed Aug 26, 2023
1 parent 1a0f0e5 commit 9ee18b5
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion components/parts/PageToc.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { Icon } from "@iconify/vue";
const route = useRoute();
const { data: article } = await useAsyncData(route.path, () => queryContent(route.path).findOne());
const { data: article } = await useAsyncData(() => queryContent(route.path).findOne());
const links = article.value?.body.toc?.links;
Expand Down
2 changes: 1 addition & 1 deletion pages/[content].vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { BLOG_TITLE } from "@/utils/const";
const route = useRoute();
const { data: article } = await useAsyncData(route.path, () => queryContent(route.path).findOne());
const { data: article } = await useAsyncData(() => queryContent(route.path).findOne());
useSeoMeta({
title: `${article.value?.title} | ${BLOG_TITLE}`,
Expand Down
2 changes: 1 addition & 1 deletion pages/_story/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if (import.meta.env.PROD) {
const route = useRoute();
const { data: article } = await useAsyncData("article", () => queryContent(route.path).findOne());
const { data: article } = await useAsyncData(() => queryContent(route.path).findOne());
const links = article.value?.body.toc?.links;
</script>
Expand Down
16 changes: 8 additions & 8 deletions pages/blog/[...slug].vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { BLOG_TITLE, BLOG_CATEGORIES } from "@/utils/const";
const route = useRoute();
const { data: article } = await useAsyncData(route.path, () => queryContent(route.path).findOne());
const { data: article } = await useAsyncData(() => queryContent(route.path).findOne());
const title = computed(() => `${article.value?.title} | ${BLOG_TITLE}`);
const url = computed(() => `${import.meta.env.VITE_NUXT_PUBLIC_SITE_URL}${article.value?._path}`);
Expand Down Expand Up @@ -41,17 +41,17 @@ const navigations = computed(() => {
<div v-if="article">
<div class="mb-8">
<BreadCrumb :navigations="navigations"></BreadCrumb>
<ProseH1>{{ article.title }}</ProseH1>
<ProseH1>{{ article?.title }}</ProseH1>
<div class="flex flex-row items-center gap-2 text-sm text-slate-500">
<IconWithText v-if="article.createdAt" icon="ph:clock">
{{ article.createdAt }}
<IconWithText v-if="article?.createdAt" icon="ph:clock">
{{ article?.createdAt }}
</IconWithText>
<IconWithText v-if="article.updatedAt" icon="ph:clock-clockwise">
{{ article.updatedAt }}
<IconWithText v-if="article?.updatedAt" icon="ph:clock-clockwise">
{{ article?.updatedAt }}
</IconWithText>
<div class="flex flex-row gap-1">
<NuxtLink
v-for="tag in article.tags"
v-for="tag in article?.tags"
:key="tag"
:to="`/search?word=${tag}`"
class="badge badge-sm gap-1"
Expand All @@ -65,7 +65,7 @@ const navigations = computed(() => {
<div class="grid grid-cols-12">
<div class="col-span-12 flex flex-col gap-4 lg:col-span-8">
<div class="mx-auto mb-8">
<img :src="article.thumbnail" />
<img :src="article?.thumbnail" />
</div>
<div class="col-span-4 mb-8 block lg:hidden">
<PageToc></PageToc>
Expand Down

0 comments on commit 9ee18b5

Please sign in to comment.