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);
|
2021-11-26 09:31:50 +01:00
|
|
|
return this.http.post(url, formData, {withCredentials: true});
|
2019-06-02 20:52:26 +02:00
|
|
|
}
|
|
|
|
|
2021-11-26 09:31:50 +01:00
|
|
|
deletePhoto(url: string): Observable<any> {
|
|
|
|
return this.http.delete(url, {withCredentials: true});
|
2019-06-02 20:52:26 +02:00
|
|
|
}
|
2021-11-26 09:31:50 +01:00
|
|
|
|
2019-06-02 20:52:26 +02:00
|
|
|
}
|