Fix confusing UX around enabled

This commit is contained in:
ekzyis 2024-07-03 02:34:14 +02:00
parent d7c81cfa9f
commit 2aa0c9bc99
1 changed files with 5 additions and 10 deletions

View File

@ -202,16 +202,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
if (config || toEnable) {
config = { ...config, enabled: toEnable }
window.localStorage.setItem(key, JSON.stringify(config))
}
}
const key = getStorageKey(name, me)
const config = JSON.parse(window.localStorage.getItem(key))
if (!config) return
config.enabled = true
window.localStorage.setItem(key, JSON.stringify(config))
}
function disableWallet (name, me) {