import { MutationCache, QueryCache, QueryClient } from '@tanstack/react-query'

const queryCache = new QueryCache({
  onError: (error) => {
    // always log errors to console
    console.log(error)
  },
})

const mutationCache = new MutationCache({
  onError: (error) => {
    console.log(error)
  },
})

export const queryClient = new QueryClient({
  defaultOptions: {
    queries: {
      refetchOnWindowFocus: false,
      retry: 0,
    },
  },
  queryCache,
  mutationCache,
})
