()
| 24 | } |
| 25 | |
| 26 | const fetchPosts = async () => { |
| 27 | console.info('Fetching posts...') |
| 28 | await new Promise((r) => setTimeout(r, 300)) |
| 29 | return axios |
| 30 | .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts') |
| 31 | .then((r) => r.data.slice(0, 10)) |
| 32 | } |
| 33 | |
| 34 | const fetchPost = async (postId: number) => { |
| 35 | console.info(`Fetching post with id ${postId}...`) |