(postId: string)
| 22 | } |
| 23 | |
| 24 | export const fetchPost = async (postId: string) => { |
| 25 | console.info(`Fetching post with id ${postId}...`) |
| 26 | const post = await axios |
| 27 | .get<PostType>(`${queryURL}/posts/${postId}`) |
| 28 | .then((r) => r.data) |
| 29 | |
| 30 | // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition |
| 31 | if (!post) { |
| 32 | throw new NotFoundError(`Post with id "${postId}" not found!`) |
| 33 | } |
| 34 | |
| 35 | return post |
| 36 | } |
no test coverage detected