tests done except for sample and samples component

This commit is contained in:
VLE2FE
2020-06-22 10:22:45 +02:00
parent 0d77113704
commit 09598c4ba7
25 changed files with 474 additions and 267 deletions

View File

@ -5,6 +5,7 @@ import {Observable} from 'rxjs';
import {ErrorComponent} from '../error/error.component';
import {ModalService} from '@inst-iot/bosch-angular-ui-components';
@Injectable({
providedIn: 'root'
})
@ -37,9 +38,14 @@ export class ApiService {
private requestErrorHandler<T>(observable: Observable<any>, f: (data?: T, err?) => void) {
observable.subscribe(data => {
f(data, undefined);
}, () => {
const modalRef = this.modalService.openComponent(ErrorComponent);
modalRef.instance.message = 'Network request failed!';
}, err => {
if (f.length === 2) {
f(undefined, err);
}
else {
const modalRef = this.modalService.openComponent(ErrorComponent);
modalRef.instance.message = 'Network request failed!';
}
});
}