import { Injectable } from '@angular/core' ; import { HttpClient } from '@angular/common/http' ; import { LocationStrategy } from '@angular/common' ; import { Observable , of } from 'rxjs' ; import { map , catchError } from 'rxjs/operators' ; import { ApiResponse , AutoAction } from '../../shared/models' ; import { ApiService } from 'src/app/shared/services' ; @ Injectable ( ) export class AutoActionsService extends ApiService { constructor ( private http , strat ) { super ( strat ) ; } addAction ( action ) { return this . http . post ( this . apiBase + 'autoactions' , action ) . pipe ( map ( ( response ) => response ) , catchError ( ( err ) => of ( err . error as ApiResponse ) ) ) ; } removeAction ( action ) { return this . http . delete ( this . apiBase + 'autoactions/' + action . id ) . pipe ( map ( ( response ) => response ) , catchError ( ( err ) => of ( err . error as ApiResponse ) ) ) ; } }