Skip to content

Scheduling infrastructure for absolutely everyone.

fix: use platform me typing (#16214)

Morgand60f16522347
diff --git a/apps/web/components/settings/platform/hooks/useGetUserAttributes.ts b/apps/web/components/settings/platform/hooks/useGetUserAttributes.ts
index 31f0dc11379..e837f115fda 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 f08361350c5..b3e3c61f993 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<UserResponse>({
queryKey: [QUERY_KEY],
- queryFn: async () => {
+ queryFn: async (): Promise<UserResponse> => {
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;
},
});