argos/dmp-frontend/src/app/core/services/project/project-file-upload.service.ts

27 lines
981 B
TypeScript

import { HttpHeaders } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { environment } from '../../../../environments/environment';
import { ContentFile } from '../../model/project/project-listing';
import { BaseHttpService } from '../http/base-http.service';
import { BaseHttpParams } from '../../../common/http/base-http-params';
import { InterceptorType } from '../../../common/http/interceptors/interceptor-type';
@Injectable()
export class ProjectFileUploadService {
private actionUrl: string;
private headers: HttpHeaders;
constructor(private http: BaseHttpService) {
this.actionUrl = environment.Server + 'files/';
}
uploadFile(formData: FormData): Observable<ContentFile> {
const params = new BaseHttpParams();
params.interceptorContext = {
excludedInterceptors: [InterceptorType.JSONContentType]
};
return this.http.post(this.actionUrl + 'upload', formData, { params: params });
}
}