website refactor
This commit is contained in:
@@ -4,11 +4,13 @@ import { DRIVER_SERVICE_TOKEN } from '@/lib/di/tokens';
|
||||
import { enhanceQueryResult } from '@/lib/di/hooks/useReactQueryWithApiError';
|
||||
import { ApiError } from '@/lib/api/base/ApiError';
|
||||
import type { DriverDTO } from '@/lib/types/generated/DriverDTO';
|
||||
import { useAuth } from '@/components/auth/AuthContext';
|
||||
|
||||
export function useCurrentDriver(
|
||||
options?: Omit<UseQueryOptions<DriverDTO | null, ApiError>, 'queryKey' | 'queryFn'>
|
||||
) {
|
||||
const driverService = useInject(DRIVER_SERVICE_TOKEN);
|
||||
const { session } = useAuth();
|
||||
|
||||
const queryResult = useQuery({
|
||||
queryKey: ['currentDriver'],
|
||||
@@ -19,6 +21,9 @@ export function useCurrentDriver(
|
||||
}
|
||||
return result.unwrap();
|
||||
},
|
||||
enabled: !!session,
|
||||
retry: false,
|
||||
refetchOnWindowFocus: false,
|
||||
...options,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user