Fix enableWallet
* wrong storage key was used * broke if wallets with no configs existed
This commit is contained in:
parent
399c62a7e3
commit
a5ea53dc39
|
@ -127,11 +127,11 @@ function getStorageKey (name, me) {
|
||||||
function enableWallet (name, me) {
|
function enableWallet (name, me) {
|
||||||
// mark all wallets as disabled except the one to enable
|
// mark all wallets as disabled except the one to enable
|
||||||
for (const walletDef of WALLET_DEFS) {
|
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 toEnable = walletDef.name === name
|
||||||
const key = getStorageKey(name, me)
|
if (config || toEnable) {
|
||||||
const config = JSON.parse(window.localStorage.getItem(key))
|
config = { ...config, enabled: toEnable }
|
||||||
if (config.enabled || toEnable) {
|
|
||||||
config.enabled = toEnable
|
|
||||||
window.localStorage.setItem(key, JSON.stringify(config))
|
window.localStorage.setItem(key, JSON.stringify(config))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue