Skip to content

Commit

Permalink
fix(@wallet): delete selected account
Browse files Browse the repository at this point in the history
  • Loading branch information
alaibe committed Apr 25, 2023
1 parent c94997d commit bdaf122
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/app/modules/main/wallet_section/overview/module.nim
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,11 @@ proc setBalance(self: Module, tokens: seq[WalletTokenDto]) =

# TODO(alaibe): replace with filter logic
method switchAccount*(self: Module, accountIndex: int) =
var walletAccount = self.controller.getWalletAccount(accountIndex)
self.currentAccountIndex = accountIndex

let walletAccount = self.controller.getWalletAccount(accountIndex)
if walletAccount.isNil:
self.currentAccountIndex = 0
walletAccount = self.controller.getWalletAccount(self.currentAccountIndex)

let item = initItem(
walletAccount.name,
Expand Down Expand Up @@ -133,4 +135,5 @@ proc onAccountAdded(self: Module, account: WalletAccountDto) =
self.switchAccount(self.currentAccountIndex)

proc onAccountRemoved(self: Module, account: WalletAccountDto) =
self.switchAccount(self.currentAccountIndex)
self.switchAccount(self.currentAccountIndex)

0 comments on commit bdaf122

Please sign in to comment.