import { HttpHeaders } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { Observable } from 'rxjs'; import 'rxjs/add/operator/map'; import { environment } from '../../../environments/environment'; import { ContentFile } from '../../models/files/ContentFile'; import { FileUploader } from '../../shared/components/file-uploader/FileUploader'; import { BaseHttpService } from '../../utilities/cite-http-service-module/base-http.service'; @Injectable() export class ProjectFileUploaderService implements FileUploader { private actionUrl: string; private headers: HttpHeaders; constructor(private http: BaseHttpService) { this.actionUrl = environment.Server + 'files/'; this.headers = new HttpHeaders(); this.headers = this.headers.set('Content-Type', 'application/json'); this.headers = this.headers.set('Accept', 'application/json'); } uploadFile(formData: FormData): Observable { return this.http.post(this.actionUrl + 'upload', formData, this.headers); } }