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:
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user