refactor: only check platform billing for platforms (#15507)

This commit is contained in:
Lauris Skraucis
2024-06-20 10:27:42 +00:00
committed by GitHub
parent d0a7eb12a0
commit f760a8ac26
2 changed files with 4 additions and 3 deletions
@@ -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;