mirror of
https://github.com/bitwarden/browser
synced 2025-12-31 07:33:23 +00:00
23 lines
648 B
TypeScript
23 lines
648 B
TypeScript
import { BrowserApi } from '../../browser/browserApi';
|
|
|
|
import { Injectable } from '@angular/core';
|
|
import {
|
|
CanActivate,
|
|
Router,
|
|
} from '@angular/router';
|
|
|
|
import { UnauthGuardService } from 'jslib-angular/services/unauth-guard.service';
|
|
|
|
@Injectable()
|
|
export class LaunchGuardService implements CanActivate {
|
|
constructor(private router: Router, private unauthGuardService: UnauthGuardService) { }
|
|
|
|
async canActivate() {
|
|
if (BrowserApi.getBackgroundPage() == null) {
|
|
this.router.navigate(['private-mode']);
|
|
return false;
|
|
}
|
|
return await this.unauthGuardService.canActivate();
|
|
}
|
|
}
|