Skip to content

Commit

Permalink
Hide notification automatically (#677)
Browse files Browse the repository at this point in the history
* set txHash for success notification

* change the timeout as 8s
  • Loading branch information
sirius651 authored Jan 30, 2023
1 parent f62b6b9 commit f4c88d8
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/hooks/dapps-staking/useCompoundRewards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ export function useCompoundRewards() {
{
msg: t('dappStaking.toast.successfullySetRewardDest'),
alertType: 'success',
txHash: result.txHash,
},
{ root: true }
);
Expand Down
1 change: 1 addition & 0 deletions src/hooks/dapps-staking/useUnbonding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/hooks/useCustomSignature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
1 change: 1 addition & 0 deletions src/hooks/useFaucet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ export function useFaucet(isModalFaucet?: Ref<boolean>) {
store.dispatch('general/showAlertMsg', {
msg,
alertType: 'success',
txHash: data.hash,
});
hash.value = data.hash;
} catch (e: any) {
Expand Down
4 changes: 4 additions & 0 deletions src/store/general/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ const actions: ActionTree<State, StateInterface> = {
txHash,
};
commit('pushAlertMsg', alert);

setTimeout(() => {
commit('removeAlertMsg', 0);
}, 8000);
},
removeAlertMsg({ commit }, { index }) {
commit('removeAlertMsg', index);
Expand Down

0 comments on commit f4c88d8

Please sign in to comment.