diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 98054b8..ddc40d3 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -40,7 +40,7 @@ export class AppComponent implements OnInit{ ngOnInit() { // Try to log in user 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))) { this.router.navigate(['/']); } diff --git a/src/app/services/api.service.ts b/src/app/services/api.service.ts index aa79880..8947014 100644 --- a/src/app/services/api.service.ts +++ b/src/app/services/api.service.ts @@ -11,14 +11,21 @@ import {ModalService} from '@inst-iot/bosch-angular-ui-components'; }) export class ApiService { - private host = isDevMode() ? '/api' : 'https://definma-api.apps.de1.bosch-iot-cloud.com'; + private host: string; constructor( private http: HttpClient, private storage: LocalStorageService, private modalService: ModalService, 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() { return this.host;