import { Injectable } from '@angular/core'; import { HttpClient, HttpParams } from '@angular/common/http'; import { HttpHeaders } 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'; @Injectable() export class UserService extends BaseService { public handleError: HandleError; constructor( public syncResponseErrorHandleService: SyncResponseErrorHandleService, public authService: AuthService, public http: HttpClient, public httpErrorHandler: HttpErrorHandler) { super(authService, httpErrorHandler, http, AppConfig.settings.apiserviceurl, 'UserManagementApi', '', syncResponseErrorHandleService); this.handleError = httpErrorHandler.createHandleError('UserService'); } apiserviceurl = AppConfig.settings.UserManagerSettings.authority; apiUrl = 'api/UserManagementApi/'; UpdateDefaultOcCode(): Observable { return this.http.post(this.apiserviceurl + this.apiUrl + 'UpdateDefaultOcCode', null, { headers: this.GetHeaders(), }) .pipe( tap(r => { this.syncResponseErrorHandleService.SyncResponseErrorHandle(r); }), catchError(this.handleError('UpdateDefaultOcCode', null)) ); } }