2018-02-05 14:14:59 +01:00
|
|
|
import { Injectable } from '@angular/core';
|
|
|
|
import { Router, Resolve, RouterStateSnapshot,
|
|
|
|
ActivatedRouteSnapshot } from '@angular/router';
|
|
|
|
|
|
|
|
import { EnvProperties } from './env-properties';
|
|
|
|
import { EnvironmentSpecificService } from './environment-specific.service';
|
|
|
|
|
|
|
|
@Injectable()
|
|
|
|
export class EnvironmentSpecificResolver implements Resolve<EnvProperties> {
|
|
|
|
constructor(private envSpecificSvc: EnvironmentSpecificService, private router: Router) {}
|
|
|
|
|
|
|
|
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<EnvProperties> {
|
|
|
|
return this.envSpecificSvc.loadEnvironment()
|
|
|
|
.then(es => {
|
2019-03-01 12:29:52 +01:00
|
|
|
|
|
|
|
return es;
|
2018-02-05 14:14:59 +01:00
|
|
|
}, error => {
|
|
|
|
console.log(error);
|
|
|
|
return null;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|