fix: prevents warnings on branding call when unauthed (#10051)

This commit is contained in:
Omar López
2023-07-11 12:06:44 +02:00
committed by GitHub
parent a9ee5d6f7f
commit a2e0d44fb8
@@ -1,5 +1,12 @@
import { useSession } from "next-auth/react";
import { trpc } from "@calcom/trpc/react";
export function useOrgBrandingValues() {
return trpc.viewer.organizations.getBrand.useQuery().data;
const session = useSession();
return trpc.viewer.organizations.getBrand.useQuery(undefined, {
// Only fetch if we have a session to avoid flooding logs with errors
enabled: session.status === "authenticated",
initialData: null,
}).data;
}