diff --git a/source/renderer/app/components/voting/voting-governance/VotingPowerDelegationConfirmationDialog.tsx b/source/renderer/app/components/voting/voting-governance/VotingPowerDelegationConfirmationDialog.tsx
index 633a78693f..50335b7825 100644
--- a/source/renderer/app/components/voting/voting-governance/VotingPowerDelegationConfirmationDialog.tsx
+++ b/source/renderer/app/components/voting/voting-governance/VotingPowerDelegationConfirmationDialog.tsx
@@ -31,6 +31,7 @@ type VotingPowerDelegationConfirmationDialogProps = {
onSubmit: (
passphrase?: string
) => Promise<{ success: true } | { success: false; error: string }>;
+ redirectToWallet: (walletId: string) => void;
selectedWallet: Wallet;
};
@@ -42,6 +43,7 @@ export function VotingPowerDelegationConfirmationDialog({
onClose,
onExternalLinkClick,
onSubmit,
+ redirectToWallet,
selectedWallet,
}: VotingPowerDelegationConfirmationDialogProps) {
const [state, setState] = useState<
@@ -63,15 +65,18 @@ export function VotingPowerDelegationConfirmationDialog({
const result = await onSubmit(passphrase);
- if (result.success === false) {
- setState({
- ...state,
- error: result.error,
- status: 'awaiting',
- });
+ if (result.success === true) {
+ redirectToWallet(selectedWallet.id);
+ return;
}
+
+ setState({
+ ...state,
+ error: result.error,
+ status: 'awaiting',
+ });
})();
- }, [onSubmit, state]);
+ }, [onSubmit, redirectToWallet, state]);
return (
) : (
{
if (state.status !== 'awaiting') return;
diff --git a/source/renderer/app/containers/voting/VotingGovernancePage.tsx b/source/renderer/app/containers/voting/VotingGovernancePage.tsx
index 127b23ce75..241906b139 100644
--- a/source/renderer/app/containers/voting/VotingGovernancePage.tsx
+++ b/source/renderer/app/containers/voting/VotingGovernancePage.tsx
@@ -3,6 +3,7 @@ import { inject, observer } from 'mobx-react';
import type { InjectedProps } from '../../types/injectedPropsType';
import VotingPowerDelegation from '../../components/voting/voting-governance/VotingPowerDelegation';
import { VotingPowerDelegationConfirmationDialog } from '../../components/voting/voting-governance/VotingPowerDelegationConfirmationDialog';
+import { ROUTES } from '../../routes-config';
type Props = InjectedProps;
@@ -52,6 +53,14 @@ class VotingGovernancePage extends Component {
wallet: selectedWallet,
})
}
+ redirectToWallet={(id) => {
+ this.props.actions.router.goToRoute.trigger({
+ route: ROUTES.WALLETS.SUMMARY,
+ params: {
+ id,
+ },
+ });
+ }}
selectedWallet={selectedWallet}
/>
)}
diff --git a/source/renderer/app/stores/VotingStore.ts b/source/renderer/app/stores/VotingStore.ts
index ed6f0c2ae9..a2d06e8446 100644
--- a/source/renderer/app/stores/VotingStore.ts
+++ b/source/renderer/app/stores/VotingStore.ts
@@ -289,9 +289,6 @@ export default class VotingStore extends Store {
passphrase,
walletId: wallet.id,
}).promise;
- await this.actions.router.goToRoute.trigger({
- route: ROUTES.WALLETS.SUMMARY,
- });
return {
success: true,