ekangularbase
Version:
Authentication service for usermanagement(oidc client)
57 lines (48 loc) • 2.16 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 '../auth/http-error-handler.service';
import { AuthService } from '../auth/auth.service';
import { AppConfig } from '../AppConfig/AppConfig';
import { BaseService } from '../baseclass/BaseService';
import { SyncResponseErrorHandleService } from '../route/SyncResponseErrorHandle';
import { SideBarMenuClass } from './side-bar-menu';
export class SideBarMenuService extends BaseService<SideBarMenuClass> {
sideBarMenulistClass: SideBarMenuClass[];
public handleError: HandleError;
public routeData: any;
public isAdd: boolean;
constructor(
public syncResponseErrorHandleService: SyncResponseErrorHandleService,
public authService: AuthService,
public http: HttpClient,
public httpErrorHandler: HttpErrorHandler) {
super(authService, httpErrorHandler, http, AppConfig.settings.ipmsbaseurl, 'SideBarMenu');
this.handleError = httpErrorHandler.createHandleError('SideBarMenuService');
}
apiserviceurl = AppConfig.settings.ipmsbaseurl;
apiUrl = 'api/SideBarMenu/';
GetByModule(ModuleName: string): Observable<SideBarMenuClass[]> {
return this.http.get<SideBarMenuClass[]>(this.apiserviceurl + this.apiUrl
+ 'GetAllByModule/' + ModuleName,
{
headers: this.GetHeaders(),
})
.pipe(
catchError(this.handleError('GetSideBarMenu', []))
);
}
GetAllByMRC(ModuleName: string): Observable<SideBarMenuClass[]> {
return this.http.get<SideBarMenuClass[]>(this.apiserviceurl + this.apiUrl
+ 'GetAllByMRC/' + ModuleName,
{
headers: this.GetHeaders(),
})
.pipe(
catchError(this.handleError('GetSideBarMenu', []))
);
}
}