Open History to see the last commit
1import type { Location } from './types'
2β
3export const locationsAPI = {
4 getLocation: async (locationId: string): Promise<Location> => {
5 const res = await fetch(
6 `https://rickandmortyapi.com/api/location/${locationId}`,
7 )
8 if (!res.ok) throw new Error('Failed to fetch location')
9 return await res.json()
10 },
11}