Projekt

Obecné

Profil

Stáhnout (653 Bajtů) Statistiky
| Větev: | Tag: | Revize:
1
import { Injectable } from '@angular/core';
2
import { HttpClient, HttpHeaders } from '@angular/common/http';
3
import { Observable } from 'rxjs';
4
import { QueryResponse } from '../model/QueryResponse';
5
import { Query } from '../model/Query';
6

    
7
const httpOptions = {
8
  headers: new HttpHeaders( {
9
    'Content-Type': 'application/json'
10
  })
11
};
12

    
13
@Injectable({
14
  providedIn: 'root'
15
})
16
export class QueryService {
17

    
18
  backendUrl: string = 'http://localhost:8080/';
19

    
20
  constructor(private httpClient: HttpClient) {}
21

    
22
  sendQuery(query: Query): Observable<QueryResponse> {
23
    return this.httpClient.post<QueryResponse>(this.backendUrl, query, httpOptions);
24
  }
25
}
(2-2/2)