From f995c803f942ce46c2016ce7a94ef3c45576195a Mon Sep 17 00:00:00 2001 From: ryanwolhuter Date: Mon, 16 Oct 2023 11:09:30 +0200 Subject: [PATCH] add error notifications Signed-off-by: ryanwolhuter --- .../HandleOutcome/HandleOutcome.vue | 46 +++++++++++-------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/src/plugins/oSnap/components/HandleOutcome/HandleOutcome.vue b/src/plugins/oSnap/components/HandleOutcome/HandleOutcome.vue index e183c583..7666c5bc 100644 --- a/src/plugins/oSnap/components/HandleOutcome/HandleOutcome.vue +++ b/src/plugins/oSnap/components/HandleOutcome/HandleOutcome.vue @@ -83,8 +83,6 @@ async function ensureRightNetwork(chainId: Network) { } } -const { t } = useI18n(); - const { web3 } = useWeb3(); const { createPendingTransaction, @@ -169,11 +167,12 @@ async function onApproveBond() { updatePendingTransaction(txPendingId, { hash: step.value.hash }); actionButtonState.value = 'idle'; await approvingBond.next(); - notify(t('notify.youDidIt')); + notify('Successfully approved bond'); await sleep(3e3); await updateDetails(); } catch (e) { console.error(e); + notify(['red', 'Failed to approve bond']); actionButtonState.value = 'idle'; } finally { removePendingTransaction(txPendingId); @@ -204,10 +203,11 @@ async function onSubmitProposal() { updatePendingTransaction(txPendingId, { hash: step.value.hash }); actionButtonState.value = 'idle'; await proposalSubmission.next(); - notify(t('notify.youDidIt')); + notify('Proposal submitted successfully'); await sleep(3e3); await updateDetails(); } catch (e) { + notify(['red', 'Failed to submit proposal']); console.error(e); } finally { actionButtonState.value = 'idle'; @@ -238,10 +238,11 @@ async function onExecuteProposal() { updatePendingTransaction(txPendingId, { hash: step.value.hash }); actionButtonState.value = 'idle'; await executingProposal.next(); - notify(t('notify.youDidIt')); + notify('Proposal executed successfully'); await sleep(3e3); await updateDetails(); } catch (err) { + notify(['red', 'Failed to execute proposal']); actionButtonState.value = 'idle'; } finally { removePendingTransaction(txPendingId); @@ -339,12 +340,10 @@ onMounted(async () => {