import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { Observable } from 'rxjs'; import { catchError, tap } from 'rxjs/operators'; import { HttpErrorHandler, HandleError } from '../../../src/auth/http-error-handler.service'; import { AuthService } from '../../../src/auth/auth.service'; import { AppConfig } from '../../../src/AppConfig/AppConfig'; import { BaseService } from '../../../src/baseclass/BaseService'; import { SyncResponseErrorHandleService } from '../../../src/route/SyncResponseErrorHandle'; import { FileInput } from 'ekangularbase/src/interface/FileInput'; @Injectable() export class FileManagerService extends BaseService { public handleError: HandleError; constructor( public syncResponseErrorHandleService: SyncResponseErrorHandleService, public authService: AuthService, public http: HttpClient, public httpErrorHandler: HttpErrorHandler) { super(authService, httpErrorHandler, http, AppConfig.settings.filemanagerurl, 'FileManager', '', syncResponseErrorHandleService); this.handleError = httpErrorHandler.createHandleError('FileManagerService'); } apiserviceurl = AppConfig.settings.filemanagerurl; apiUrl = 'api/FileManager/'; Post(fileInput: FileInput): Observable { return this.http.post(this.apiserviceurl + this.apiUrl, fileInput, { headers: this.GetHeaders(), }) .pipe( tap(r => { this.syncResponseErrorHandleService.SyncResponseErrorHandle(r); }), catchError(this.handleError('UpdateDefaultOcCode', null)) ); } }