Skip to content

Commit

Permalink
Invalidate balance and tasks after successful claim
Browse files Browse the repository at this point in the history
  • Loading branch information
samchuk-vlad committed Jul 5, 2024
1 parent c780403 commit 894d1a7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/modules/telegram/TasksPage/ClaimTaskTokensModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ import WarningIcon from '@/assets/icons/warning.png'
import Button from '@/components/Button'
import LinkText from '@/components/LinkText'
import useToastError from '@/hooks/useToastError'
import { getBalanceQuery } from '@/services/datahub/leaderboard/points-balance/query'
import { GamificationTask } from '@/services/datahub/tasks'
import { useClaimTaskTokens } from '@/services/datahub/tasks/mutation'
import {
clearGamificationTasksError,
getGamificationTasksErrorQuery,
getGamificationTasksQuery,
} from '@/services/datahub/tasks/query'
import { useMyMainAddress } from '@/stores/my-account'
import { cx } from '@/utils/class-names'
import { LocalStorage } from '@/utils/storage'
import { formatNumber } from '@/utils/strings'
Expand Down Expand Up @@ -74,6 +77,7 @@ const ClaimTasksTokensModal = ({
const [isOpenAnimation, setIsOpenAnimation] = useState(false)
const client = useQueryClient()
const [loading, setLoading] = useState(false)
const myAddress = useMyMainAddress()

const { data: claimTaskTokensError } =
getGamificationTasksErrorQuery.useQuery('error')
Expand Down Expand Up @@ -103,8 +107,10 @@ const ClaimTasksTokensModal = ({

if (claimTaskTokensError === 'None') {
setIsOpenAnimation(true)
getGamificationTasksQuery.invalidate(client, myAddress)
getBalanceQuery.invalidate(client, myAddress)
}
}, [claimTaskTokensError])
}, [claimTaskTokensError, client, myAddress])

useToastError(error, 'Failed to claim task tokens')

Expand Down

0 comments on commit 894d1a7

Please sign in to comment.