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