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) { function enableWallet (name, me) {
// mark all wallets as disabled except the one to enable const key = getStorageKey(name, me)
for (const walletDef of WALLET_DEFS) { const config = JSON.parse(window.localStorage.getItem(key))
const key = getStorageKey(walletDef.name, me) if (!config) return
let config = JSON.parse(window.localStorage.getItem(key)) config.enabled = true
const toEnable = walletDef.name === name window.localStorage.setItem(key, JSON.stringify(config))
if (config || toEnable) {
config = { ...config, enabled: toEnable }
window.localStorage.setItem(key, JSON.stringify(config))
}
}
} }
function disableWallet (name, me) { function disableWallet (name, me) {