2022-10-10 15:56:13 +02:00
|
|
|
import {Injectable} from '@angular/core';
|
|
|
|
import {ActivatedRouteSnapshot, CanActivate, CanLoad, Route, Router, RouterStateSnapshot, UrlSegment, UrlTree} from '@angular/router';
|
|
|
|
import {Observable} from 'rxjs';
|
|
|
|
|
|
|
|
import {properties} from "../../../environments/environment";
|
|
|
|
|
2023-09-07 18:13:59 +02:00
|
|
|
@Injectable({
|
|
|
|
providedIn: 'root'
|
|
|
|
})
|
|
|
|
export class isDevelopmentGuard {
|
2022-10-10 15:56:13 +02:00
|
|
|
constructor(private router: Router) {
|
|
|
|
}
|
|
|
|
|
2023-09-07 18:13:59 +02:00
|
|
|
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree{
|
2022-10-10 15:56:13 +02:00
|
|
|
if(properties.environment == 'development') {
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
this.router.navigate([properties.errorLink]);
|
|
|
|
}
|
|
|
|
}
|
2023-09-07 18:13:59 +02:00
|
|
|
}
|