fix: slug not found status

This commit is contained in:
DIYgod 2022-11-17 14:55:55 +00:00
parent 86fe9078db
commit d58849e465
No known key found for this signature in database
GPG Key ID: D159328F47A80DCA
2 changed files with 4 additions and 4 deletions

View File

@ -316,10 +316,10 @@ export async function getPage<TRender extends boolean = false>(
},
})
).data
input.pageId = `${slug2Id.characterId}-${slug2Id.noteId}`
if (!input.pageId) {
if (!slug2Id?.noteId) {
return null
}
input.pageId = `${slug2Id.characterId}-${slug2Id.noteId}`
}
const local = getLocalPages({

View File

@ -14,10 +14,10 @@ export const fetchGetPage = async (
return null
}
const slug2Id = await getIdBySlug(input.page, input.site)
input.pageId = `${slug2Id.characterId}-${slug2Id.noteId}`
if (!input.pageId) {
if (!slug2Id?.noteId) {
return null
}
input.pageId = `${slug2Id.characterId}-${slug2Id.noteId}`
}
delete input.page
return cacheGet(key, () => pageModel.getPage(input))