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

This commit is contained in:
Omar López 2023-07-11 03:06:44 -07:00 committed by GitHub
parent a9ee5d6f7f
commit a2e0d44fb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;
}