Revision 55964
Added by Argiro Kokogiannaki almost 5 years ago
curatorPhoto.service.ts | ||
---|---|---|
1 | 1 |
import {Injectable} from '@angular/core'; |
2 | 2 |
import {Observable} from 'rxjs/Observable'; |
3 | 3 |
import {CustomOptions} from './servicesUtils/customOptions.class'; |
4 |
import {HttpClient, HttpHeaders} from '@angular/common/http'; |
|
5 |
import {COOKIE} from '../login/utils/helper.class'; |
|
4 |
import {HttpClient} from '@angular/common/http'; |
|
6 | 5 |
|
7 | 6 |
@Injectable() |
8 | 7 |
export class CuratorPhotoService { |
... | ... | |
12 | 11 |
uploadPhoto(url: string, photo: File): Observable<any> { |
13 | 12 |
const formData = new FormData(); |
14 | 13 |
formData.append('photo', photo); |
15 |
return this.http.post(url, formData, this.getAuthOptions());
|
|
14 |
return this.http.post(url, formData, CustomOptions.getAuthOptions());
|
|
16 | 15 |
} |
17 | 16 |
|
18 | 17 |
deletePhoto(url: string) { |
19 |
return this.http.delete(url, this.getAuthOptions());
|
|
18 |
return this.http.delete(url, CustomOptions.getAuthOptions());
|
|
20 | 19 |
} |
21 | 20 |
|
22 |
// TODO remove and use CustomOptions.getAuthOptions(false) |
|
23 |
private getAuthOptions(): any { |
|
24 |
const httpOptions = { |
|
25 |
headers: new HttpHeaders({ |
|
26 |
'X-XSRF-TOKEN': COOKIE.getCookie(COOKIE.cookieName_id), |
|
27 |
}) |
|
28 |
}; |
|
29 |
return httpOptions; |
|
30 |
} |
|
31 | 21 |
} |
Also available in: Unified diff
[Library|Trunk]
Merge into trunk branch angular7 rev 55729