1
0
mirror of https://github.com/bitwarden/browser synced 2026-01-06 10:33:57 +00:00

[PM-24677] Slim StateService down so it can be moved to state lib (#16021)

* Slim StateService down so it can be moved to state lib

* Fix accidental import changes

* Add `switchAccount` assertion

* Needs to use mock
This commit is contained in:
Justin Baur
2025-08-18 12:37:25 -04:00
committed by GitHub
parent ea305a0f71
commit 939fd402c3
49 changed files with 286 additions and 1274 deletions

View File

@@ -2,14 +2,15 @@
// @ts-strict-ignore
import { Component, OnInit } from "@angular/core";
import { ActivatedRoute, Router } from "@angular/router";
import { firstValueFrom } from "rxjs";
import { first } from "rxjs/operators";
import { ApiService } from "@bitwarden/common/abstractions/api.service";
import { TokenService } from "@bitwarden/common/auth/abstractions/token.service";
import { VerifyEmailRequest } from "@bitwarden/common/models/request/verify-email.request";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
import { StateService } from "@bitwarden/common/platform/abstractions/state.service";
import { ToastService } from "@bitwarden/components";
@Component({
@@ -25,7 +26,7 @@ export class VerifyEmailTokenComponent implements OnInit {
private route: ActivatedRoute,
private apiService: ApiService,
private logService: LogService,
private stateService: StateService,
private tokenService: TokenService,
private toastService: ToastService,
) {}
@@ -37,7 +38,7 @@ export class VerifyEmailTokenComponent implements OnInit {
await this.apiService.postAccountVerifyEmailToken(
new VerifyEmailRequest(qParams.userId, qParams.token),
);
if (await this.stateService.getIsAuthenticated()) {
if (await firstValueFrom(this.tokenService.hasAccessToken$(qParams.userId))) {
await this.apiService.refreshIdentityToken();
}
this.toastService.showToast({