import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { Observable, of } from 'rxjs'; import { catchError, map } from 'rxjs/operators'; import { EventDetails } from './event-details'; import { Venue } from './venue'; import { Artist } from './artist'; @Injectable({ providedIn: 'root' }) export class EventDetailsService { constructor(private http: HttpClient) { } //rootUrl = '/api'; rootUrl = ''; private handleError<T>(result?: T) { return (error: any): Observable<T> => { console.error(error); return of(result as T); }; } getEventDetail(eventID: string): Observable<EventDetails> { return this.http.get<EventDetails>(this.rootUrl + `/eventDetail/${eventID}`); } getVenueDetail(venue: string): Observable<Venue> { return this.http.get<Venue>(this.rootUrl + `/venue/${venue}`); } getArtistDetail(artist: string){ return this.http.get<Artist>(this.rootUrl + `/artist/${artist}`); } }