You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openaire-library/services/utilities.service.ts

24 lines
660 B
TypeScript

import {Injectable} from '@angular/core';
import {Observable} from 'rxjs';
import {CustomOptions} from './servicesUtils/customOptions.class';
import {HttpClient} from '@angular/common/http';
@Injectable({
providedIn: "root"
})
export class UtilitiesService {
constructor(private http: HttpClient) {
}
uploadPhoto(url: string, photo: File): Observable<any> {
const formData = new FormData();
formData.append('photo', photo);
return this.http.post(url, formData, {withCredentials: true});
}
deletePhoto(url: string): Observable<any> {
return this.http.delete(url, {withCredentials: true});
}
}