fixed type filter
This commit is contained in:
@ -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;
|
||||
|
Reference in New Issue
Block a user