(postId)
| 64 | } |
| 65 | |
| 66 | export async function getPostThread(postId) { |
| 67 | try { |
| 68 | const postResult = await apiJson(GET_CONTENT_API, {body: {postId}}); |
| 69 | return { |
| 70 | post: normalizePostContent(postResult.post), |
| 71 | comments: (postResult.comments ?? []).map(normalizePostContent), |
| 72 | }; |
| 73 | } catch (e) { |
| 74 | if (e.status === 404) { |
| 75 | throw new Error('Post not found'); |
| 76 | } |
| 77 | throw e; |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | export async function getPost(postId) { |
| 82 | return (await getPostThread(postId)).post; |
no test coverage detected