Browse Source

chore(web): fix contribute modal

pull/52/head
isra el 1 year ago
parent
commit
e262e23e2b
  1. 18
      web/components/shared/contribute-modal.tsx

18
web/components/shared/contribute-modal.tsx

@ -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')

Loading…
Cancel
Save