feat: 💨
This commit is contained in:
@@ -171,8 +171,12 @@ class LocalStorageService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
addAccount(account: TAccount) {
|
addAccount(account: TAccount) {
|
||||||
this.accounts = this.accounts.filter((act) => !isSameAccount(act, account))
|
const index = this.accounts.findIndex((act) => isSameAccount(act, account))
|
||||||
this.accounts.push(account)
|
if (index !== -1) {
|
||||||
|
this.accounts[index] = account
|
||||||
|
} else {
|
||||||
|
this.accounts.push(account)
|
||||||
|
}
|
||||||
window.localStorage.setItem(StorageKey.ACCOUNTS, JSON.stringify(this.accounts))
|
window.localStorage.setItem(StorageKey.ACCOUNTS, JSON.stringify(this.accounts))
|
||||||
return account
|
return account
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user