Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

api.ts

9 lines269 Bytes

1import type { DogsResp } from './types'
2​
3export const dogsAPI = {
4 getDogs: async (): Promise<DogsResp> => {
5 const res = await fetch('https://dog.ceo/api/breeds/list/all')
6 if (!res.ok) throw new Error('something went wrong')
7 return await res.json()
8 },
9}