Unverified Commit e5f959a9 authored by Hanwen Cheng's avatar Hanwen Cheng Committed by GitHub
Browse files

fix: redirection for account with custom path (#544)

parent 8ef57b15
Pipeline #78208 failed with stages
in 1 minute and 56 seconds
...@@ -28,6 +28,7 @@ import QrView from '../components/QrView'; ...@@ -28,6 +28,7 @@ import QrView from '../components/QrView';
import { import {
getAddressWithPath, getAddressWithPath,
getNetworkKey, getNetworkKey,
getNetworkKeyByPath,
getPathName, getPathName,
getPathsWithSubstrateNetwork, getPathsWithSubstrateNetwork,
isSubstratePath isSubstratePath
...@@ -61,11 +62,15 @@ export function PathDetailsView({ accounts, navigation, path, networkKey }) { ...@@ -61,11 +62,15 @@ export function PathDetailsView({ accounts, navigation, path, networkKey }) {
await unlockSeedPhrase(navigation); await unlockSeedPhrase(navigation);
const deleteSucceed = await accounts.deletePath(path); const deleteSucceed = await accounts.deletePath(path);
const paths = Array.from(accounts.state.currentIdentity.meta.keys()); const paths = Array.from(accounts.state.currentIdentity.meta.keys());
const listedPaths = getPathsWithSubstrateNetwork(paths, networkKey); const pathIndicatedNetworkKey = getNetworkKeyByPath(path);
const listedPaths = getPathsWithSubstrateNetwork(
paths,
pathIndicatedNetworkKey
);
const hasOtherPaths = listedPaths.length > 0; const hasOtherPaths = listedPaths.length > 0;
if (deleteSucceed) { if (deleteSucceed) {
isSubstratePath(path) && hasOtherPaths isSubstratePath(path) && hasOtherPaths
? navigateToPathsList(navigation, networkKey) ? navigateToPathsList(navigation, pathIndicatedNetworkKey)
: navigation.navigate('AccountNetworkChooser'); : navigation.navigate('AccountNetworkChooser');
} else { } else {
alertPathDeletionError(); alertPathDeletionError();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment