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'; @Injectable() export class SideBarMenuService extends BaseService { 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 { return this.http.get(this.apiserviceurl + this.apiUrl + 'GetAllByModule/' + ModuleName, { headers: this.GetHeaders(), }) .pipe( catchError(this.handleError('GetSideBarMenu', [])) ); } GetAllByMRC(ModuleName: string): Observable { return this.http.get(this.apiserviceurl + this.apiUrl + 'GetAllByMRC/' + ModuleName, { headers: this.GetHeaders(), }) .pipe( catchError(this.handleError('GetSideBarMenu', [])) ); } }