import {Injectable} from '@angular/core'; import {Observable} from 'rxjs/Observable'; import {CustomOptions} from './servicesUtils/customOptions.class'; import {HttpClient} from '@angular/common/http'; @Injectable() export class UtilitiesService { constructor(private http: HttpClient) { } uploadPhoto(url: string, photo: File): Observable { const formData = new FormData(); formData.append('photo', photo); return this.http.post(url, formData, CustomOptions.getAuthOptions()); } deletePhoto(url: string) { return this.http.delete(url, CustomOptions.getAuthOptions()); } getTiny(url: string) { return this.http.get(url, {responseType: 'text'}); } }