Skip to contentOpen History to see the last commit
api.ts
8 lines243 Bytes
1export const pokemonsAPI = { 2 getPokemon: async (id: number) => { 3 const response = await fetch(`https://pokeapi.co/api/v2/pokemon/${id}`) 4 if (!response.ok) throw new Error('Failed to fetch pokemon')