From 6b8c5e0a879ca38250f71c5b3915fb7e32d860cd Mon Sep 17 00:00:00 2001 From: DanSnow Date: Fri, 8 Dec 2023 18:21:00 +0800 Subject: [PATCH] fix: fix check author article count --- packages/karbon/src/runtime/composables/front-page.ts | 4 +++- packages/karbon/src/runtime/composables/page-meta.ts | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/karbon/src/runtime/composables/front-page.ts b/packages/karbon/src/runtime/composables/front-page.ts index 22dd9eec..584a9f52 100644 --- a/packages/karbon/src/runtime/composables/front-page.ts +++ b/packages/karbon/src/runtime/composables/front-page.ts @@ -43,7 +43,9 @@ if (import.meta.hot) { }) } -export function getAllArticles(): AsyncData { +export function getAllArticles(): Promise & + AsyncData { + // @ts-expect-error unable to modal this type return useResourceList('article', { key: 'all', transform: (data) => { diff --git a/packages/karbon/src/runtime/composables/page-meta.ts b/packages/karbon/src/runtime/composables/page-meta.ts index 9bfc29fc..e9564171 100644 --- a/packages/karbon/src/runtime/composables/page-meta.ts +++ b/packages/karbon/src/runtime/composables/page-meta.ts @@ -133,7 +133,7 @@ export function setupPage({ type, seo = true }: SetupPage const authorId = meta.value.id onServerPrefetch(async () => { - const source = (await getAllArticles()).data.value ?? [] + const source = (await getAllArticles()) ?? [] const hasArticle = source.some(({ authors }) => { return authors.some((author) => author.id === authorId) })