From a5ea53dc3998c55868fd8c7ba2ed28892abd9ca6 Mon Sep 17 00:00:00 2001 From: ekzyis Date: Fri, 21 Jun 2024 22:18:16 +0200 Subject: [PATCH] Fix enableWallet * wrong storage key was used * broke if wallets with no configs existed --- components/wallet/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/wallet/index.js b/components/wallet/index.js index bcdddb6c..7a9bb3f9 100644 --- a/components/wallet/index.js +++ b/components/wallet/index.js @@ -127,11 +127,11 @@ function getStorageKey (name, me) { function enableWallet (name, me) { // mark all wallets as disabled except the one to enable for (const walletDef of WALLET_DEFS) { + const key = getStorageKey(walletDef.name, me) + let config = JSON.parse(window.localStorage.getItem(key)) const toEnable = walletDef.name === name - const key = getStorageKey(name, me) - const config = JSON.parse(window.localStorage.getItem(key)) - if (config.enabled || toEnable) { - config.enabled = toEnable + if (config || toEnable) { + config = { ...config, enabled: toEnable } window.localStorage.setItem(key, JSON.stringify(config)) } }