({ queryKey })
| 18 | |
| 19 | // Define a default query function that will receive the query key |
| 20 | const defaultQueryFn: QueryFunction<unknown> = async ({ queryKey }) => { |
| 21 | const response = await fetch( |
| 22 | `https://jsonplaceholder.typicode.com${queryKey[0]}`, |
| 23 | { |
| 24 | method: 'GET', |
| 25 | }, |
| 26 | ) |
| 27 | if (!response.ok) throw new Error('Failed to fetch data') |
| 28 | return response.json() |
| 29 | } |
| 30 | |
| 31 | // provide the default query function to your app via the query client |
| 32 | const queryClient = new QueryClient({ |
nothing calls this directly
no outgoing calls
no test coverage detected