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 | |
---|
1 | import { Injectable } from '@angular/core';
|
---|
2 | import {Observable} from "rxjs";
|
---|
3 | import {HttpClient, HttpHeaders} from "@angular/common/http";
|
---|
4 | import {ControlsResponse} from "../../model/responses/ControlsResponse";
|
---|
5 | import {FineResponse} from "../../model/responses/FineResponse";
|
---|
6 | import {FineRequest} from "../../model/requests/FineRequest";
|
---|
7 |
|
---|
8 | @Injectable({
|
---|
9 | providedIn: 'root'
|
---|
10 | })
|
---|
11 | export 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.