diff --git a/apps/web/components/settings/platform/hooks/useGetUserAttributes.ts b/apps/web/components/settings/platform/hooks/useGetUserAttributes.ts index 31f0dc1137..e837f115fd 100644 --- a/apps/web/components/settings/platform/hooks/useGetUserAttributes.ts +++ b/apps/web/components/settings/platform/hooks/useGetUserAttributes.ts @@ -6,9 +6,9 @@ export const useGetUserAttributes = () => { const { data: platformUser, isLoading: isPlatformUserLoading } = usePlatformMe(); const { data: userBillingData, isFetching: isUserBillingDataLoading } = useCheckTeamBilling( platformUser?.organizationId, - platformUser?.organization.isPlatform + platformUser?.organization?.isPlatform ?? false ); - const isPlatformUser = platformUser?.organization.isPlatform; + const isPlatformUser = platformUser?.organization?.isPlatform ?? false; const isPaidUser = userBillingData?.valid; const userOrgId = platformUser?.organizationId; diff --git a/apps/web/components/settings/platform/hooks/usePlatformMe.ts b/apps/web/components/settings/platform/hooks/usePlatformMe.ts index f08361350c..b3e3c61f99 100644 --- a/apps/web/components/settings/platform/hooks/usePlatformMe.ts +++ b/apps/web/components/settings/platform/hooks/usePlatformMe.ts @@ -1,17 +1,19 @@ import { useQuery } from "@tanstack/react-query"; +import type { UserResponse } from "@calcom/platform-types"; + export const usePlatformMe = () => { const QUERY_KEY = "get-platform-me"; - const platformMeQuery = useQuery({ + const platformMeQuery = useQuery({ queryKey: [QUERY_KEY], - queryFn: async () => { + queryFn: async (): Promise => { const response = await fetch(`/api/v2/me`, { method: "get", headers: { "Content-type": "application/json" }, }); const data = await response.json(); - return data.data; + return data.data as UserResponse; }, });