(postId: string)
| 14 | } |
| 15 | |
| 16 | export const fetchPost = async (postId: string) => { |
| 17 | console.info(`Fetching post with id ${postId}...`) |
| 18 | await new Promise((r) => setTimeout(r, 500)) |
| 19 | const post = await axios |
| 20 | .get<PostType>(`${queryURL}/posts/${postId}`) |
| 21 | .then((r) => r.data) |
| 22 | .catch((err) => { |
| 23 | if (err.status === 404) { |
| 24 | throw notFound() |
| 25 | } |
| 26 | throw err |
| 27 | }) |
| 28 | |
| 29 | return post |
| 30 | } |
| 31 | |
| 32 | export const fetchPosts = async () => { |
| 33 | console.info('Fetching posts...') |
no test coverage detected