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