ekangularbase
Version:
Authentication service for usermanagement(oidc client)
44 lines (34 loc) • 1.7 kB
text/typescript
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';
()
export class FileManagerService extends BaseService<null> {
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<SyncResponse> {
return this.http.post<SyncResponse>(this.apiserviceurl + this.apiUrl, fileInput, {
headers: this.GetHeaders(),
})
.pipe(
tap(r => { this.syncResponseErrorHandleService.SyncResponseErrorHandle(r); }),
catchError(this.handleError('UpdateDefaultOcCode', null))
);
}
}