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'; import { GenericUi } from 'ekangularbase/src/interface/GenericUi'; @Injectable() export class GenericUiService 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, 'GenericUiApi', '', syncResponseErrorHandleService); this.handleError = httpErrorHandler.createHandleError('GenericUiService'); } apiserviceurl = AppConfig.settings.apiserviceurl; apiUrl = 'api/GenericUi/'; GetByType(type: string): Observable { return this.http.get(this.apiserviceurl + this.apiUrl + type, { headers: this.GetHeaders(), }) .pipe( catchError(this.handleError('GetByType', null)) ); } }