Skip to content

Commit

Permalink
fix(swap): review.vue redirect on success
Browse files Browse the repository at this point in the history
  • Loading branch information
hassnian committed Nov 14, 2024
1 parent e5fe925 commit 1da4f5c
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions components/swap/review.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ import { SwapStep } from '@/components/swap/types'
const router = useRouter()
const { $i18n } = useNuxtApp()
const { transaction, isLoading, status, isError, blockNumber } = useTransaction()
const { transaction, isLoading, status, blockNumber } = useTransaction()
const { urlPrefix } = usePrefix()
const swapStore = useAtomicSwapStore()
const { swap } = storeToRefs(swapStore)
Expand Down Expand Up @@ -134,17 +134,10 @@ const submit = () => {
})
}
watch(blockNumber, (blockNumber) => {
if (blockNumber) {
swapStore.updateSwap({ blockNumber })
}
})
useTransactionTracker({
transaction: { isError, status },
onSuccess: async () => {
watchEffect(async () => {
if (status.value === TransactionStatus.Finalized && blockNumber.value) {
swapStore.updateSwap({ blockNumber: blockNumber.value })
await navigateTo({ name: getSwapStepRouteName(SwapStep.COUNTERPARTY) })
},
waitFor: [computed(() => Boolean(swap.value.blockNumber))],
}
})
</script>

0 comments on commit 1da4f5c

Please sign in to comment.