import { useQuery } from '@tanstack/react-query'
import { refreshAccessToken } from '@shared/api/tokenStore'

export const AUTH_QUERY_KEY = ['auth']

export function useAuth() {
  return useQuery({
    queryKey: AUTH_QUERY_KEY,
    queryFn: refreshAccessToken,
    retry: false,
    staleTime: Infinity,
    gcTime: Infinity,
    refetchOnWindowFocus: false,
  })
}
