refactor: only check platform billing for platforms (#15507)
This commit is contained in:
@@ -4,7 +4,8 @@ import { useCheckTeamBilling } from "@calcom/web/lib/hooks/settings/platform/oau
|
||||
export const useGetUserAttributes = () => {
|
||||
const { data: user, isLoading: isUserLoading } = useMeQuery();
|
||||
const { data: userBillingData, isFetching: isUserBillingDataLoading } = useCheckTeamBilling(
|
||||
user?.organizationId
|
||||
user?.organizationId,
|
||||
user?.organization.isPlatform
|
||||
);
|
||||
const isPlatformUser = user?.organization.isPlatform;
|
||||
const isPaidUser = userBillingData?.valid;
|
||||
|
||||
@@ -119,7 +119,7 @@ export const useDeleteOAuthClient = (
|
||||
return mutation;
|
||||
};
|
||||
|
||||
export const useCheckTeamBilling = (teamId?: number | null) => {
|
||||
export const useCheckTeamBilling = (teamId?: number | null, isPlatformTeam?: boolean | null) => {
|
||||
const QUERY_KEY = "check-team-billing";
|
||||
const isTeamBilledAlready = useQuery({
|
||||
queryKey: [QUERY_KEY, teamId],
|
||||
@@ -132,7 +132,7 @@ export const useCheckTeamBilling = (teamId?: number | null) => {
|
||||
|
||||
return data.data;
|
||||
},
|
||||
enabled: !!teamId,
|
||||
enabled: !!teamId && !!isPlatformTeam,
|
||||
});
|
||||
|
||||
return isTeamBilledAlready;
|
||||
|
||||
Reference in New Issue
Block a user