Changeset View
Changeset View
Standalone View
Standalone View
src/app/_services/http.service.ts
Show First 20 Lines • Show All 72 Lines • ▼ Show 20 Lines | export class HttpService { | ||||
PUT_IMAGE(passedUrl: string, body: any): Observable<any> { | PUT_IMAGE(passedUrl: string, body: any): Observable<any> { | ||||
// PUT to api | // PUT to api | ||||
return this.http.put(this.apiURL + passedUrl, body, this.getOptionsForImage()) | return this.http.put(this.apiURL + passedUrl, body, this.getOptionsForImage()) | ||||
.catch((error: any) => this.handleError(error)); | .catch((error: any) => this.handleError(error)); | ||||
} | } | ||||
// Handling methods | // Handling methods | ||||
private handleError(error: any): Observable<any> { | private handleError(error: any): Observable<any> { | ||||
console.error(error); | |||||
let message: string; | let message: string; | ||||
let action = 'Close'; | let action = 'Close'; | ||||
let onAction: Function; | let onAction: Function; | ||||
if (!navigator.onLine) { | if (!navigator.onLine) { | ||||
this.snackBar.open('Your internet appears to be down', action, { | this.snackBar.open('Your internet appears to be down', action, { | ||||
duration: 20000 | duration: 20000 | ||||
}); | }); | ||||
▲ Show 20 Lines • Show All 75 Lines • Show Last 20 Lines |