(postId: string)
| 8 | } |
| 9 | |
| 10 | export const fetchPost = async (postId: string) => { |
| 11 | console.info(`Fetching post with id ${postId}...`) |
| 12 | await new Promise((r) => setTimeout(r, 500)) |
| 13 | const post = await axios |
| 14 | .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${postId}`) |
| 15 | .then((r) => r.data) |
| 16 | .catch((err) => { |
| 17 | if (err.status === 404) { |
| 18 | throw notFound() |
| 19 | } |
| 20 | throw err |
| 21 | }) |
| 22 | |
| 23 | return post |
| 24 | } |
| 25 | |
| 26 | export const fetchPosts = async () => { |
| 27 | console.info('Fetching posts...') |
no test coverage detected