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