1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-31 07:33:23 +00:00
Files
browser/src/popup/services/launch-guard.service.ts
2021-12-06 12:21:07 +01:00

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();
}
}