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

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

split group project and individual project into two separate folders

  • Property mode set to 100644
File size: 994 bytes
Line 
1import { Injectable } from '@angular/core';
2import {Observable} from "rxjs";
3import {HttpClient, HttpHeaders} from "@angular/common/http";
4import {ControlsResponse} from "../../model/responses/ControlsResponse";
5import {FineResponse} from "../../model/responses/FineResponse";
6import {FineRequest} from "../../model/requests/FineRequest";
7
8@Injectable({
9 providedIn: 'root'
10})
11export class ControlsService {
12 private url = '/api/controls'
13
14 constructor(private http: HttpClient) { }
15
16 getControls(): Observable<ControlsResponse[]> {
17 return this.http.get<ControlsResponse[]>(`${this.url}`)
18 }
19
20 start(routeInstanceId: number): Observable<ControlsResponse> {
21 return this.http.put<ControlsResponse>(`${this.url}/start`, JSON.stringify(routeInstanceId), {
22 headers: new HttpHeaders({'Content-Type': 'application/json'})
23 })
24 }
25
26 getControlInfo(controlId: number): Observable<FineResponse[]> {
27 return this.http.get<FineResponse[]>(`${this.url}/${controlId}/fines`)
28 }
29}
Note: See TracBrowser for help on using the repository browser.