diff --git a/src/modules/posts/api/get/fetchPostById.ts b/src/modules/posts/api/get/fetchPostById.ts index 55f3a01..dd373ad 100644 --- a/src/modules/posts/api/get/fetchPostById.ts +++ b/src/modules/posts/api/get/fetchPostById.ts @@ -4,24 +4,12 @@ import { parseContent } from "@/shared/api/parseContent"; import { App, WPv2 } from "@/shared/types/app"; export const fetchPostById = async (id: number): Promise => { - const [post, categories] = await Promise.all([ - wp.posts().id(id).get() as Promise, - wp.categories().get() as Promise - ]); - - const categoryMap = new Map( - categories.map((c) => [c.id, c.name]) - ); - - const postCategories = post.categories.map( - (id) => categoryMap.get(id) || "" - ); + const post = await wp.posts().id(id).get() as WPv2.Post; const result: App.WpPostPage = { id: post.id, title: post.title.rendered, content: parseContent(post.content.rendered), - categories: postCategories, tag: post.tags[0], };