fix: ensure apiClient initialization and update resource queries in authentication flow

This commit is contained in:
Mo Tarbin
2026-02-10 00:42:25 -05:00
parent 1ce7749826
commit 9c115efecb
6 changed files with 33 additions and 15 deletions

View File

@@ -13,7 +13,7 @@ const isTokenValid = () => {
}
export const useResource = () => {
const { data, isLoading, error } = useQuery({
const { data, isLoading, error, refetch } = useQuery({
queryKey: ['resource'],
queryFn: async () => {
const response = await GetResource()
@@ -22,7 +22,6 @@ export const useResource = () => {
staleTime: 6 * 60 * 60 * 1000, // 6 hours in milliseconds
refetchOnWindowFocus: false,
refetchOnReconnect: false,
enabled: isTokenValid(), // Only run query when we have a valid token
})
return { data, isLoading, error }
return { data, isLoading, error, refetch }
}