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 } from '../../shared/models' ; import { BoardData } from './board-data.model' ; import { ApiService } from 'src/app/shared/services' ; @ Injectable ( ) export class BoardAdminService extends ApiService { constructor ( private http , strat ) { super ( strat ) ; } addBoard ( board ) { return this . http . post ( this . apiBase + 'boards' , board ) . pipe ( map ( ( response ) => response ) , catchError ( ( err ) => of ( err . error as ApiResponse ) ) ) ; } editBoard ( board ) { return this . http . post ( this . apiBase + 'boards/' + board . id , board ) . pipe ( map ( ( response ) => response ) , catchError ( ( err ) => of ( err . error as ApiResponse ) ) ) ; } removeBoard ( boardId ) { return this . http . delete ( this . apiBase + 'boards/' + boardId ) . pipe ( map ( ( response ) => response ) , catchError ( ( err ) => of ( err . error as ApiResponse ) ) ) ; } }