mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-24 12:06:15 +01:00
Route on switchAccountFinish Message (#7422)
This commit is contained in:
parent
fb0e8fc2ff
commit
f2eea12b4f
@ -1,9 +1,27 @@
|
||||
import { Component } from "@angular/core";
|
||||
import { firstValueFrom } from "rxjs";
|
||||
|
||||
import { UpdateTempPasswordComponent as BaseUpdateTempPasswordComponent } from "@bitwarden/angular/auth/components/update-temp-password.component";
|
||||
|
||||
import { postLogoutMessageListener$ } from "./utils/post-logout-message-listener";
|
||||
|
||||
@Component({
|
||||
selector: "app-update-temp-password",
|
||||
templateUrl: "update-temp-password.component.html",
|
||||
})
|
||||
export class UpdateTempPasswordComponent extends BaseUpdateTempPasswordComponent {}
|
||||
export class UpdateTempPasswordComponent extends BaseUpdateTempPasswordComponent {
|
||||
onSuccessfulChangePassword: () => Promise<void> = this.doOnSuccessfulChangePassword.bind(this);
|
||||
|
||||
private async doOnSuccessfulChangePassword() {
|
||||
// start listening for "switchAccountFinish" or "doneLoggingOut"
|
||||
const messagePromise = firstValueFrom(postLogoutMessageListener$);
|
||||
this.messagingService.send("logout");
|
||||
// wait for messages
|
||||
const command = await messagePromise;
|
||||
|
||||
// doneLoggingOut already has a message handler that will navigate us
|
||||
if (command === "switchAccountFinish") {
|
||||
this.router.navigate(["/"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ export class UpdateTempPasswordComponent extends BaseChangePasswordComponent {
|
||||
private syncService: SyncService,
|
||||
private logService: LogService,
|
||||
private userVerificationService: UserVerificationService,
|
||||
private router: Router,
|
||||
protected router: Router,
|
||||
dialogService: DialogService,
|
||||
) {
|
||||
super(
|
||||
|
Loading…
Reference in New Issue
Block a user