fix: use platform me typing (#16214)
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user