Fix priority ignored when fetching enabled wallet

This commit is contained in:
ekzyis 2024-07-08 05:49:54 +02:00
parent a69bca0f05
commit 459478036f
1 changed files with 4 additions and 3 deletions

View File

@ -246,14 +246,15 @@ export function getServerWallet (type) {
}
export function getEnabledWallet (me) {
// TODO: handle multiple enabled wallets
return WALLET_DEFS
.filter(def => !!def.sendPayment)
.find(def => {
.map(def => {
const key = getStorageKey(def.name, me)
const config = SSR ? null : JSON.parse(window?.localStorage.getItem(key))
return config?.enabled
return { def, config }
})
.filter(({ config }) => config?.enabled)
.sort((w1, w2) => w1.config.priority - w2.config.priority)[0]?.def
}
export function useWallets () {