source: bus-n-go-pavel-216049/bus-n-go-frontend/src/app/services/line/line.service.ts

Last change on this file was baf4cc4, checked in by ppaunovski <paunovskipavel@…>, 4 weeks ago

split group project and individual project into two separate folders

  • Property mode set to 100644
File size: 644 bytes
RevLine 
[baf4cc4]1import { Injectable } from '@angular/core';
2import {Observable} from "rxjs";
3import {HttpClient} from "@angular/common/http";
4import {Line} from "../../model/Line";
5import {Direction} from "../../model/Direction";
6import {LineDirection} from "../../model/LineDirection";
7
8@Injectable({
9 providedIn: 'root'
10})
11export class LineService {
12 private url = '/api/lines'
13 constructor(private _http: HttpClient) { }
14
15 getAll(): Observable<Line[]> {
16 return this._http.get<Line[]>(`${this.url}`)
17 }
18
19 getDirections(line: Line): Observable<LineDirection[]> {
20 return this._http.get<LineDirection[]>(`${this.url}/${line.id}/directions`)
21 }
22}
Note: See TracBrowser for help on using the repository browser.