2019-06-02 20:52:26 +02:00
|
|
|
import {Injectable} from '@angular/core';
|
2021-07-14 13:19:57 +02:00
|
|
|
import {Observable} from 'rxjs';
|
2019-06-02 20:52:26 +02:00
|
|
|
import {CustomOptions} from './servicesUtils/customOptions.class';
|
2019-06-03 15:20:36 +02:00
|
|
|
import {HttpClient} from '@angular/common/http';
|
2019-06-02 20:52:26 +02:00
|
|
|
|
2020-09-28 23:29:46 +02:00
|
|
|
@Injectable({
|
|
|
|
providedIn: "root"
|
|
|
|
})
|
2019-06-06 12:51:39 +02:00
|
|
|
export class UtilitiesService {
|
2019-06-02 20:52:26 +02:00
|
|
|
constructor(private http: HttpClient) {
|
|
|
|
}
|
|
|
|
|
|
|
|
uploadPhoto(url: string, photo: File): Observable<any> {
|
|
|
|
const formData = new FormData();
|
|
|
|
formData.append('photo', photo);
|
2019-06-03 15:20:36 +02:00
|
|
|
return this.http.post(url, formData, CustomOptions.getAuthOptions());
|
2019-06-02 20:52:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
deletePhoto(url: string) {
|
2019-06-03 15:20:36 +02:00
|
|
|
return this.http.delete(url, CustomOptions.getAuthOptions());
|
2019-06-02 20:52:26 +02:00
|
|
|
}
|
|
|
|
|
2019-06-06 12:51:39 +02:00
|
|
|
getTiny(url: string) {
|
|
|
|
return this.http.get(url, {responseType: 'text'});
|
|
|
|
}
|
|
|
|
|
2019-06-02 20:52:26 +02:00
|
|
|
}
|