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