fixed type filter

This commit is contained in:
VLE2FE
2020-08-14 14:29:17 +02:00
parent 5f6411c613
commit f07c3be23a
7 changed files with 104 additions and 56 deletions

View File

@ -44,24 +44,29 @@ export class ApiService {
observable.subscribe(data => {
f(data.body, undefined, data.headers.keys().reduce((s, e) => {s[e.toLowerCase()] = data.headers.get(e); return s; }, {}));
}, err => {
if (f.length === 2) {
f(undefined, err);
console.log(f.length);
if (f.length > 1) {
f(undefined, err, undefined);
}
else {
const modalRef = this.modalService.openComponent(ErrorComponent);
modalRef.instance.message = 'Network request failed!';
const details = [err.error.status];
if (err.error.details) {
details.push(err.error.details);
}
modalRef.instance.details = details;
modalRef.result.then(() => {
this.window.location.reload();
});
this.requestError(err);
}
});
}
requestError(err) {
const modalRef = this.modalService.openComponent(ErrorComponent);
modalRef.instance.message = 'Network request failed!';
const details = [err.error.status];
if (err.error.details) {
details.push(err.error.details);
}
modalRef.instance.details = details;
modalRef.result.then(() => {
this.window.location.reload();
});
}
private url(url) {
if (/http[s]?:\/\//.test(url)) {
return url;