Allow looking up articles by ID

iOS needs to be able to lookup an article by its ID not its
slug, because the slug can change once saved.
This commit is contained in:
Jackson Harper 2022-05-02 15:48:18 -07:00
parent fedd92488b
commit 453b301e74

View file

@ -426,7 +426,9 @@ export const getArticleResolver: ResolverFn<
})
await createIntercomEvent('get-article', claims.uid)
const page = await getPageByParam({ userId: claims.uid, slug })
// We allow the backend to use the ID instead of a slug to fetch the article
const page = await getPageByParam({ userId: claims.uid, slug }) || await getPageByParam({ userId: claims.uid, _id: slug })
if (!page) {
return { errorCodes: [ArticleErrorCode.NotFound] }
}