source: bus-n-go-pavel-216049/bus-n-go-frontend/src/app/services/commute/commute.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: 819 bytes
Line 
1import { Injectable } from '@angular/core';
2import {HttpClient, HttpHeaders} from "@angular/common/http";
3import {StartCommuteRequest} from "../../model/requests/StartCommuteRequest";
4import {Observable, tap} from "rxjs";
5import {CommuteResponse} from "../../model/responses/CommuteResponse";
6import {RouteInstanceResponse} from "../../model/responses/RouteInstanceResponse";
7
8@Injectable({
9 providedIn: 'root'
10})
11export 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.