mirror of
https://github.com/bitwarden/browser
synced 2025-12-13 06:43:35 +00:00
[refactor(Account Switching)] Implement StateService (#424)
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import * as program from "commander";
|
||||
|
||||
import { EnvironmentService } from "jslib-common/abstractions/environment.service";
|
||||
import { StateService } from "jslib-common/abstractions/state.service";
|
||||
import { SyncService } from "jslib-common/abstractions/sync.service";
|
||||
import { UserService } from "jslib-common/abstractions/user.service";
|
||||
import { VaultTimeoutService } from "jslib-common/abstractions/vaultTimeout.service";
|
||||
|
||||
import { Response } from "jslib-node/cli/models/response";
|
||||
@@ -13,7 +13,7 @@ export class StatusCommand {
|
||||
constructor(
|
||||
private envService: EnvironmentService,
|
||||
private syncService: SyncService,
|
||||
private userService: UserService,
|
||||
private stateService: StateService,
|
||||
private vaultTimeoutService: VaultTimeoutService
|
||||
) {}
|
||||
|
||||
@@ -22,8 +22,8 @@ export class StatusCommand {
|
||||
const baseUrl = this.baseUrl();
|
||||
const status = await this.status();
|
||||
const lastSync = await this.syncService.getLastSync();
|
||||
const userId = await this.userService.getUserId();
|
||||
const email = await this.userService.getEmail();
|
||||
const userId = await this.stateService.getUserId();
|
||||
const email = await this.stateService.getEmail();
|
||||
|
||||
return Response.success(
|
||||
new TemplateResponse({
|
||||
@@ -44,7 +44,7 @@ export class StatusCommand {
|
||||
}
|
||||
|
||||
private async status(): Promise<string> {
|
||||
const authed = await this.userService.isAuthenticated();
|
||||
const authed = await this.stateService.getIsAuthenticated();
|
||||
if (!authed) {
|
||||
return "unauthenticated";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user