(query = {})
| 51 | try { |
| 52 | const postResult = await apiJson(GET_CONTENT_API, {body: {postId}}); |
| 53 | return { |
| 54 | post: normalizePostContent(postResult.post), |
| 55 | comments: (postResult.comments ?? []).map(normalizePostContent), |
| 56 | }; |
| 57 | } catch (e) { |
| 58 | if (e.status === 404) { |
| 59 | throw new Error('Post not found'); |
| 60 | } |
| 61 | throw e; |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | export async function getPost(postId) { |
| 66 | return (await getPostThread(postId)).post; |
| 67 | } |
no test coverage detected