Skip to content

Commit

Permalink
fix(mobile): remove entitlement cache (#311)
Browse files Browse the repository at this point in the history
  • Loading branch information
bkdev98 authored Sep 11, 2024
1 parent 788f693 commit d88e674
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion apps/mobile/hooks/use-purchases.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { toast } from '@/components/common/toast'
import type { Entitlement } from '@/lib/constaints'
import { useUser } from '@clerk/clerk-expo'
import { useQuery } from '@tanstack/react-query'
import { usePostHog } from 'posthog-react-native'
import { useEffect } from 'react'
Expand Down Expand Up @@ -32,10 +33,16 @@ export function usePurchasesPackages() {

export function useUserEntitlements() {
const posthog = usePostHog()
const { user } = useUser()

const { data: customerInfo, refetch } = useQuery({
queryKey: ['entitlementsx'],
queryKey: ['entitlements', user?.id],
queryFn: Purchases.getCustomerInfo,
refetchInterval: 1000 * 60,
enabled: !!user?.id,
networkMode: 'online',
gcTime: 0,
staleTime: 0,
})

const isWealth = !!customerInfo?.entitlements.active.wealth?.isActive
Expand Down

0 comments on commit d88e674

Please sign in to comment.