Skip to content

Commit

Permalink
fix: 🐛 deleting last profile brings the user back to the start screen…
Browse files Browse the repository at this point in the history
… now
  • Loading branch information
EnricoBarbieri1997 committed Aug 4, 2022
1 parent 50c79e5 commit f050e72
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions stores/WalletStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import SettingsStore from "./SettingsStore";
import LocalStorageManager from "./LocalStorageManager";
import { askPin } from "navigation/AskPin";
import uuid from 'react-native-uuid';
import { navigate } from "navigation/utils";

export const cosmos_mnemonic_prefix = "mnemonic_"

Expand Down Expand Up @@ -355,6 +356,12 @@ export default class WalletStore {
if(p == undefined) return
this.localStorageManager?.removeProfileData(p)
this.profiles.splice(this.profiles.indexOf(p), 1)
if(this.profiles.length < 1)
{
this.activeProfile = null
navigate("Start")
return
}
if(p == this.activeProfile) this.activeProfile = this.profiles[0]
}
}

0 comments on commit f050e72

Please sign in to comment.