Newer
Older
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { Bar } from '../models/bar.model';
@Injectable({
providedIn: 'root'
})
export class BarsService {
constructor(private http: HttpClient) {}
// authInterceptor add the token in the HTTP request
public getAllBars(): Observable<Bar[]> {
return this.http.get<Bar[]>('/api/bars');
}