mirror of
https://github.com/Dvorinka/Containr.git
synced 2026-10-28 07:41:27 +00:00
20 lines
443 B
TypeScript
20 lines
443 B
TypeScript
import { useQuery } from '@tanstack/react-query';
|
|
import { getAuthSession } from '@/lib/auth-client';
|
|
|
|
type UseAuthSessionOptions = {
|
|
enabled?: boolean;
|
|
};
|
|
|
|
export function useAuthSession(options: UseAuthSessionOptions = {}) {
|
|
const { enabled = true } = options;
|
|
|
|
return useQuery({
|
|
queryKey: ['auth-session'],
|
|
queryFn: getAuthSession,
|
|
enabled,
|
|
staleTime: 30_000,
|
|
refetchOnWindowFocus: true,
|
|
retry: false,
|
|
});
|
|
}
|