import { useQuery } from "@tanstack/react-query";

export function useAuth() {
  const { data: user, isLoading } = useQuery({
    queryKey: ["/api/auth/user"],
    retry: false,
  });

  return {
    user,
    isLoading,
    isAuthenticated: !!user,
    isAdmin: (user as any)?.isAdmin || false,
    isSuperAdmin: (user as any)?.isSuperAdmin || false,
  };
}