Project

General

Profile

1 55945 k.triantaf
import {Injectable} from '@angular/core';
2
import {Observable} from 'rxjs/Observable';
3
import {CustomOptions} from './servicesUtils/customOptions.class';
4 55964 argiro.kok
import {HttpClient} from '@angular/common/http';
5 55945 k.triantaf
6
@Injectable()
7 56013 k.triantaf
export class UtilitiesService {
8 55945 k.triantaf
    constructor(private http: HttpClient) {
9
    }
10
11
    uploadPhoto(url: string, photo: File): Observable<any> {
12
        const formData = new FormData();
13
        formData.append('photo', photo);
14 55964 argiro.kok
        return this.http.post(url, formData, CustomOptions.getAuthOptions());
15 55945 k.triantaf
    }
16
17
    deletePhoto(url: string) {
18 55964 argiro.kok
        return this.http.delete(url, CustomOptions.getAuthOptions());
19 55945 k.triantaf
    }
20
21 56013 k.triantaf
    getTiny(url: string) {
22
        return this.http.get(url, {responseType: 'text'});
23
    }
24
25 55945 k.triantaf
}