From f4c88d8ce00a60568051882269f6d3e05078d817 Mon Sep 17 00:00:00 2001 From: Will Date: Mon, 30 Jan 2023 20:55:11 +0900 Subject: [PATCH] Hide notification automatically (#677) * set txHash for success notification * change the timeout as 8s --- src/hooks/dapps-staking/useCompoundRewards.ts | 1 + src/hooks/dapps-staking/useUnbonding.ts | 1 + src/hooks/useCustomSignature.ts | 1 + src/hooks/useFaucet.ts | 1 + src/store/general/actions.ts | 4 ++++ 5 files changed, 8 insertions(+) diff --git a/src/hooks/dapps-staking/useCompoundRewards.ts b/src/hooks/dapps-staking/useCompoundRewards.ts index 945dbb0f5..9a77cec70 100644 --- a/src/hooks/dapps-staking/useCompoundRewards.ts +++ b/src/hooks/dapps-staking/useCompoundRewards.ts @@ -97,6 +97,7 @@ export function useCompoundRewards() { { msg: t('dappStaking.toast.successfullySetRewardDest'), alertType: 'success', + txHash: result.txHash, }, { root: true } ); diff --git a/src/hooks/dapps-staking/useUnbonding.ts b/src/hooks/dapps-staking/useUnbonding.ts index 9ab3e0dac..d7e7250d2 100644 --- a/src/hooks/dapps-staking/useUnbonding.ts +++ b/src/hooks/dapps-staking/useUnbonding.ts @@ -45,6 +45,7 @@ export function useUnbonding() { store.dispatch('general/showAlertMsg', { msg: t('dappStaking.toast.successfullyWithdrew'), alertType: 'success', + txHash: result.txHash, }); } store.commit('general/setLoading', false); diff --git a/src/hooks/useCustomSignature.ts b/src/hooks/useCustomSignature.ts index 51a6957d8..9a6576318 100644 --- a/src/hooks/useCustomSignature.ts +++ b/src/hooks/useCustomSignature.ts @@ -41,6 +41,7 @@ export function useCustomSignature({ fn, txType }: { fn?: () => void; txType?: T store.dispatch('general/showAlertMsg', { msg, alertType: 'success', + txHash: hash, }); showLoading(store.dispatch, false); diff --git a/src/hooks/useFaucet.ts b/src/hooks/useFaucet.ts index ade9e9cfb..086e0b208 100644 --- a/src/hooks/useFaucet.ts +++ b/src/hooks/useFaucet.ts @@ -101,6 +101,7 @@ export function useFaucet(isModalFaucet?: Ref) { store.dispatch('general/showAlertMsg', { msg, alertType: 'success', + txHash: data.hash, }); hash.value = data.hash; } catch (e: any) { diff --git a/src/store/general/actions.ts b/src/store/general/actions.ts index ef8a2a9ad..ec2f646de 100644 --- a/src/store/general/actions.ts +++ b/src/store/general/actions.ts @@ -10,6 +10,10 @@ const actions: ActionTree = { txHash, }; commit('pushAlertMsg', alert); + + setTimeout(() => { + commit('removeAlertMsg', 0); + }, 8000); }, removeAlertMsg({ commit }, { index }) { commit('removeAlertMsg', index);