ekangularbase
Version:
Authentication service for usermanagement(oidc client)
44 lines (34 loc) • 1.69 kB
text/typescript
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';
()
export class GenericUiService 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.apiserviceurl,
'GenericUiApi', '', syncResponseErrorHandleService);
this.handleError = httpErrorHandler.createHandleError('GenericUiService');
}
apiserviceurl = AppConfig.settings.apiserviceurl;
apiUrl = 'api/GenericUi/';
GetByType(type: string): Observable<GenericUi> {
return this.http.get<GenericUi>(this.apiserviceurl + this.apiUrl + type, {
headers: this.GetHeaders(),
})
.pipe(
catchError(this.handleError('GetByType', null))
);
}
}