1 |
f3d8e7de
|
Ondřej Váně
|
import { Injectable } from '@angular/core';
|
2 |
efc2257b
|
castic96
|
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
3 |
|
|
import { Observable } from 'rxjs';
|
4 |
f3d8e7de
|
Ondřej Váně
|
import { QueryResponse } from '../model/QueryResponse';
|
5 |
efc2257b
|
castic96
|
import { Query } from '../model/Query';
|
6 |
|
|
|
7 |
|
|
const httpOptions = {
|
8 |
|
|
headers: new HttpHeaders( {
|
9 |
|
|
'Content-Type': 'application/json'
|
10 |
|
|
})
|
11 |
|
|
};
|
12 |
f3d8e7de
|
Ondřej Váně
|
|
13 |
|
|
@Injectable({
|
14 |
|
|
providedIn: 'root'
|
15 |
|
|
})
|
16 |
|
|
export class QueryService {
|
17 |
|
|
|
18 |
efc2257b
|
castic96
|
backendUrl: string = 'http://localhost:8080/';
|
19 |
f3d8e7de
|
Ondřej Váně
|
|
20 |
efc2257b
|
castic96
|
constructor(private httpClient: HttpClient) {}
|
21 |
f3d8e7de
|
Ondřej Váně
|
|
22 |
|
|
sendQuery(query: Query): Observable<QueryResponse> {
|
23 |
efc2257b
|
castic96
|
return this.httpClient.post<QueryResponse>(this.backendUrl, query, httpOptions);
|
24 |
f3d8e7de
|
Ondřej Váně
|
}
|
25 |
|
|
}
|