mirror of
https://github.com/bitwarden/jslib
synced 2025-12-18 17:23:30 +00:00
Clean up the cached account (#672)
* Clean up the cached account * PR feedback: Avoid duplicate code
This commit is contained in:
committed by
GitHub
parent
fd0410ca4b
commit
eaf387435f
@@ -2425,13 +2425,14 @@ export class StateService<
|
|||||||
|
|
||||||
protected removeAccountFromMemory(userId: string = this.state.activeUserId): void {
|
protected removeAccountFromMemory(userId: string = this.state.activeUserId): void {
|
||||||
delete this.state.accounts[userId];
|
delete this.state.accounts[userId];
|
||||||
|
this.accountDiskCache.delete(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async pruneInMemoryAccounts() {
|
protected async pruneInMemoryAccounts() {
|
||||||
// We preserve settings for logged out accounts, but we don't want to consider them when thinking about active account state
|
// We preserve settings for logged out accounts, but we don't want to consider them when thinking about active account state
|
||||||
for (const userId in this.state.accounts) {
|
for (const userId in this.state.accounts) {
|
||||||
if (!(await this.getIsAuthenticated({ userId: userId }))) {
|
if (!(await this.getIsAuthenticated({ userId: userId }))) {
|
||||||
delete this.state.accounts[userId];
|
this.removeAccountFromMemory(userId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user