Revize efc2257b
Přidáno uživatelem castic96 před více než 4 roky(ů)
fe/fulltextsearch/src/app/services/query.service.ts | ||
---|---|---|
1 | 1 |
import { Injectable } from '@angular/core'; |
2 |
import { HttpClient } from '@angular/common/http'; |
|
3 |
import {Observable} from 'rxjs';
|
|
2 |
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
|
3 |
import { Observable } from 'rxjs';
|
|
4 | 4 |
import { QueryResponse } from '../model/QueryResponse'; |
5 |
import {Query} from '../model/Query'; |
|
5 |
import { Query } from '../model/Query'; |
|
6 |
|
|
7 |
const httpOptions = { |
|
8 |
headers: new HttpHeaders( { |
|
9 |
'Content-Type': 'application/json' |
|
10 |
}) |
|
11 |
}; |
|
6 | 12 |
|
7 | 13 |
@Injectable({ |
8 | 14 |
providedIn: 'root' |
9 | 15 |
}) |
10 | 16 |
export class QueryService { |
11 | 17 |
|
12 |
backendUrl = 'http://localhost:8080/'; |
|
13 |
|
|
18 |
backendUrl: string = 'http://localhost:8080/'; |
|
14 | 19 |
|
15 |
constructor( private httpClient: HttpClient) {}
|
|
20 |
constructor(private httpClient: HttpClient) {} |
|
16 | 21 |
|
17 | 22 |
sendQuery(query: Query): Observable<QueryResponse> { |
18 |
return this.httpClient.post<QueryResponse>(this.backendUrl, query); |
|
23 |
return this.httpClient.post<QueryResponse>(this.backendUrl, query, httpOptions);
|
|
19 | 24 |
} |
20 | 25 |
} |
Také k dispozici: Unified diff
Re #7658: Integrace frontendu a backendu
- upraven Dockerfile v backendu, aby prováděl build v Dockeru
- přidána konstanta httpOptions, úprava dle code conventions