Open History to see the last commit
1import type { Author } from './types'
2β
3export const authorsAPI = {
4 getAuthor: async (id: number): Promise<Author> => {
5 const response = await fetch(
6 `https://jsonplaceholder.typicode.com/users/${id}`,
7 )
8 if (!response.ok) throw new Error('Failed to fetch author')
9 return await response.json()
10 },
11}