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:
819 bytes
|
Line | |
---|
1 | import { Injectable } from '@angular/core';
|
---|
2 | import {HttpClient, HttpHeaders} from "@angular/common/http";
|
---|
3 | import {StartCommuteRequest} from "../../model/requests/StartCommuteRequest";
|
---|
4 | import {Observable, tap} from "rxjs";
|
---|
5 | import {CommuteResponse} from "../../model/responses/CommuteResponse";
|
---|
6 | import {RouteInstanceResponse} from "../../model/responses/RouteInstanceResponse";
|
---|
7 |
|
---|
8 | @Injectable({
|
---|
9 | providedIn: 'root'
|
---|
10 | })
|
---|
11 | export class CommuteService {
|
---|
12 |
|
---|
13 | private url = '/api/commutes'
|
---|
14 |
|
---|
15 | constructor(private http: HttpClient) { }
|
---|
16 |
|
---|
17 | startCommute(request: StartCommuteRequest): Observable<CommuteResponse> {
|
---|
18 | return this.http.put<CommuteResponse>(`${this.url}/start`, JSON.stringify(request), {
|
---|
19 | headers: new HttpHeaders({'Content-Type': 'application/json'})
|
---|
20 | }).pipe(
|
---|
21 | tap(res => console.log(res))
|
---|
22 | )
|
---|
23 | }
|
---|
24 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.