Skip to content
This repository has been archived by the owner on Nov 20, 2024. It is now read-only.

Commit

Permalink
fix: fix check author article count
Browse files Browse the repository at this point in the history
  • Loading branch information
DanSnow committed Dec 8, 2023
1 parent 10bb345 commit 6b8c5e0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/karbon/src/runtime/composables/front-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ if (import.meta.hot) {
})
}

export function getAllArticles(): AsyncData<UseArticleReturnWithURL[], true | null> {
export function getAllArticles(): Promise<UseArticleReturnWithURL[]> &
AsyncData<UseArticleReturnWithURL[], true | null> {
// @ts-expect-error unable to modal this type
return useResourceList('article', {
key: 'all',
transform: (data) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/karbon/src/runtime/composables/page-meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export function setupPage<Type extends PageType>({ 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)
})
Expand Down

0 comments on commit 6b8c5e0

Please sign in to comment.