feat: 💨

This commit is contained in:
codytseng
2025-06-12 23:29:12 +08:00
parent d81dc3fe4e
commit c09c002471

View File

@@ -171,8 +171,12 @@ class LocalStorageService {
}
addAccount(account: TAccount) {
this.accounts = this.accounts.filter((act) => !isSameAccount(act, account))
const index = this.accounts.findIndex((act) => isSameAccount(act, account))
if (index !== -1) {
this.accounts[index] = account
} else {
this.accounts.push(account)
}
window.localStorage.setItem(StorageKey.ACCOUNTS, JSON.stringify(this.accounts))
return account
}