mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-26 12:25:20 +01:00
Clean up the cached account (#672)
* Clean up the cached account * PR feedback: Avoid duplicate code
This commit is contained in:
parent
fd0410ca4b
commit
eaf387435f
@ -2425,13 +2425,14 @@ export class StateService<
|
||||
|
||||
protected removeAccountFromMemory(userId: string = this.state.activeUserId): void {
|
||||
delete this.state.accounts[userId];
|
||||
this.accountDiskCache.delete(userId);
|
||||
}
|
||||
|
||||
protected async pruneInMemoryAccounts() {
|
||||
// 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) {
|
||||
if (!(await this.getIsAuthenticated({ userId: userId }))) {
|
||||
delete this.state.accounts[userId];
|
||||
this.removeAccountFromMemory(userId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user