Use test API when running as test instance
This commit is contained in:
parent
340afc59e0
commit
7ce83fca92
@ -40,7 +40,7 @@ export class AppComponent implements OnInit{
|
|||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
// Try to log in user
|
// Try to log in user
|
||||||
this.login.login().then(res => {
|
this.login.login().then(res => {
|
||||||
// Return to home page if log failed, except when on documentation pages
|
// Return to home page if log in failed, except when on documentation pages
|
||||||
if (!res && !(/\/documentation/.test(this.router.url))) {
|
if (!res && !(/\/documentation/.test(this.router.url))) {
|
||||||
this.router.navigate(['/']);
|
this.router.navigate(['/']);
|
||||||
}
|
}
|
||||||
|
@ -11,14 +11,21 @@ import {ModalService} from '@inst-iot/bosch-angular-ui-components';
|
|||||||
})
|
})
|
||||||
export class ApiService {
|
export class ApiService {
|
||||||
|
|
||||||
private host = isDevMode() ? '/api' : 'https://definma-api.apps.de1.bosch-iot-cloud.com';
|
private host: string;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private http: HttpClient,
|
private http: HttpClient,
|
||||||
private storage: LocalStorageService,
|
private storage: LocalStorageService,
|
||||||
private modalService: ModalService,
|
private modalService: ModalService,
|
||||||
private window: Window
|
private window: Window
|
||||||
) { }
|
) {
|
||||||
|
if(isDevMode())
|
||||||
|
this.host = '/api';
|
||||||
|
else if(window.location.hostname === 'definma-test.apps.de1.bosch-iot-cloud.com')
|
||||||
|
this.host = 'https://definma-api-test.apps.de1.bosch-iot-cloud.com';
|
||||||
|
else
|
||||||
|
this.host = 'https://definma-api.apps.de1.bosch-iot-cloud.com';
|
||||||
|
}
|
||||||
|
|
||||||
get hostName() {
|
get hostName() {
|
||||||
return this.host;
|
return this.host;
|
||||||
|
Loading…
Reference in New Issue
Block a user