From f050e725dfffe95cc1d92aa537dce2416f78ff59 Mon Sep 17 00:00:00 2001 From: Enrico Barbieri Date: Thu, 4 Aug 2022 14:48:52 +0200 Subject: [PATCH] fix: :bug: deleting last profile brings the user back to the start screen now --- stores/WalletStore.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/stores/WalletStore.ts b/stores/WalletStore.ts index 752594ce..68ff1677 100644 --- a/stores/WalletStore.ts +++ b/stores/WalletStore.ts @@ -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_" @@ -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] } } \ No newline at end of file