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

api.ts

11 lines345 Bytes

1const baseUrl = import.meta.env.SSR
2 ? `http://localhost:${process.env.PORT || 5173}`
3 : ''
4​
5export const waitAPI = {
6 getWait: async (wait: number): Promise<string> => {
7 const response = await fetch(`${baseUrl}/api/wait?wait=${wait}`)
8 if (!response.ok) throw new Error('Failed to fetch data')
9 return await response.json()
10 },