Fix logging out non active user

This commit is contained in:
Matt Gibson 2024-04-23 20:56:57 -04:00
parent 31a8de1a51
commit faa43c0957
No known key found for this signature in database
GPG Key ID: 963EE038B0581878
1 changed files with 3 additions and 5 deletions

View File

@ -565,9 +565,9 @@ export class AppComponent implements OnInit, OnDestroy {
}
private async logOut(expired: boolean, userId?: string) {
const userBeingLoggedOut = await firstValueFrom(
this.accountService.activeAccount$.pipe(map((a) => a?.id)),
);
const userBeingLoggedOut =
(userId as UserId) ??
(await firstValueFrom(this.accountService.activeAccount$.pipe(map((a) => a?.id))));
// Mark account as being cleaned up so that the updateAppMenu logic (executed on syncCompleted)
// doesn't attempt to update a user that is being logged out as we will manually
@ -597,8 +597,6 @@ export class AppComponent implements OnInit, OnDestroy {
this.finishAccountCleanUp(userBeingLoggedOut);
}
await this.accountService.switchAccount(nextUpAccount?.id);
if (nextUpAccount == null) {
// FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling.
// eslint-disable-next-line @typescript-eslint/no-floating-promises