Use test API when running as test instance

This commit is contained in:
Kai S. K. Engelbart 2021-03-09 16:52:59 +01:00 committed by Ruben Hartenstein (PEA4-Fe)
parent 340afc59e0
commit 7ce83fca92
2 changed files with 10 additions and 3 deletions

View File

@ -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(['/']);
}

View File

@ -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;