import { HttpClient } from '@angular/common/http' ; import { Observable } from 'rxjs/Observable' ; import { map } from 'rxjs/operators' ; import { pizzaInitialState } from 'app/shared/states/pizzas/pizzas.initial-state' ; import { IPizzaBackendWithDetailsAndFk , IPizzaBackendWithDetailsAndFkUi , } from 'app/shared/states/pizzas/pizzas.interfaces' ; import { environment } from 'environments/environment' ; export abstract class PizzasService { abstract fetchPizza ( id ) ; } export class PizzasServiceImpl extends PizzasService { constructor ( private http ) { super ( ) ; } fetchPizza ( id ) { return this . http . get < IPizzaBackendWithDetailsAndFk > ( `${ environment . urlBackend }/pizzas/${ id }` ) . pipe ( map ( data => pizzaInitialState ( data ) ) ) ; } }