all work till 15 jan
This commit is contained in:
parent
81e5b8cf52
commit
017919aa4b
249 changed files with 127261 additions and 45869 deletions
30
src/app/dbauth.guard.ts
Normal file
30
src/app/dbauth.guard.ts
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
import { Injectable } from "@angular/core";
|
||||
import {
|
||||
CanActivate,
|
||||
ActivatedRouteSnapshot,
|
||||
RouterStateSnapshot,
|
||||
} from "@angular/router";
|
||||
import { Observable } from "rxjs/Observable";
|
||||
import { Router } from "@angular/router";
|
||||
@Injectable()
|
||||
export class DbauthGuard implements CanActivate {
|
||||
constructor(private router: Router) {}
|
||||
canActivate(
|
||||
next: ActivatedRouteSnapshot,
|
||||
state: RouterStateSnapshot
|
||||
): Observable<boolean> | Promise<boolean> | boolean {
|
||||
if (
|
||||
window.location.origin.match(/nipponsecura.in/g) != null &&
|
||||
state.url == "/add_newDevice"
|
||||
) {
|
||||
this.router.navigateByUrl("add_newDevice2");
|
||||
} else if (
|
||||
window.location.origin.match(/nipponsecura.in/g) != null &&
|
||||
state.url == "/editDevice"
|
||||
) {
|
||||
this.router.navigateByUrl("db_editDevice");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue