chore(web): fix contribute modal

This commit is contained in:
isra el
2025-02-24 00:20:45 +03:00
parent f9734c417a
commit e262e23e2b

View File

@@ -50,24 +50,24 @@ export function ContributeModal() {
}
const {
data: currentPlan,
isLoading: isLoadingPlan,
error: planError,
data: currentSubscription,
isLoading: isLoadingSubscription,
error: subscriptionError,
} = useQuery({
queryKey: ['currentPlan'],
queryKey: ['currentSubscription'],
queryFn: () =>
httpBrowserClient
.get(ApiEndpoints.billing.currentPlan())
.get(ApiEndpoints.billing.currentSubscription())
.then((res) => res.data),
})
useEffect(() => {
const checkAndShowModal = () => {
if (isLoadingPlan) return
if (planError) return
if (isLoadingSubscription) return
if (subscriptionError) return
if (currentPlan?.name?.toLowerCase() !== 'free') {
if (currentSubscription?.plan?.name?.toLowerCase() !== 'free') {
return
}
@@ -97,7 +97,7 @@ export function ContributeModal() {
checkAndShowModal()
}
})
}, [currentPlan?.name, isLoadingPlan, planError])
}, [currentSubscription?.plan?.name, isLoadingSubscription, subscriptionError])
const handleContributed = () => {
localStorage.setItem(STORAGE_KEYS.HAS_CONTRIBUTED, 'true')