1
0
mirror of https://github.com/bitwarden/directory-connector synced 2025-12-05 23:53:21 +00:00
Files
directory-connector/src/app/services/launch-guard.service.ts
Oscar Hinton 6097bca063 Add jslib as a "real" dependency (#127)
* Split jslib

* Change hook to preinstall

* Install gyp (ci)

* Fix rebuild command

* Review comments

* Add tsconfig-paths-plugin to webpack.cli.

* Bump jslib

* Install old version of prebuild-install to bypass bug in pkg
2021-06-09 21:46:38 +02:00

23 lines
575 B
TypeScript

import { Injectable } from '@angular/core';
import {
CanActivate,
Router,
} from '@angular/router';
import { ApiKeyService } from 'jslib-common/abstractions/apiKey.service';
@Injectable()
export class LaunchGuardService implements CanActivate {
constructor(private apiKeyService: ApiKeyService, private router: Router) { }
async canActivate() {
const isAuthed = await this.apiKeyService.isAuthenticated();
if (!isAuthed) {
return true;
}
this.router.navigate(['/tabs/dashboard']);
return false;
}
}