()
| 10 | } |
| 11 | |
| 12 | const fetchPosts = async () => { |
| 13 | console.info('Fetching posts...') |
| 14 | await new Promise((r) => setTimeout(r, 500)) |
| 15 | return axios |
| 16 | .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts') |
| 17 | .then((r) => r.data.slice(0, 10)) |
| 18 | } |
| 19 | |
| 20 | const fetchPost = async (postId: string) => { |
| 21 | console.info(`Fetching post with id ${postId}...`) |