2019-01-18 18:03:45 +01:00
|
|
|
import { HttpHeaders } from '@angular/common/http';
|
|
|
|
import { Injectable } from '@angular/core';
|
|
|
|
import { Observable } from 'rxjs';
|
|
|
|
import { SearchBarItem } from '../../model/dashboard/search-bar-item';
|
|
|
|
import { BaseHttpService } from '../http/base-http.service';
|
2020-03-26 17:44:12 +01:00
|
|
|
import { ConfigurationService } from '../configuration/configuration.service';
|
2019-01-18 18:03:45 +01:00
|
|
|
|
|
|
|
@Injectable()
|
|
|
|
export class SearchBarService {
|
|
|
|
|
|
|
|
private actionUrl: string;
|
|
|
|
private headers: HttpHeaders;
|
|
|
|
|
2020-03-26 17:44:12 +01:00
|
|
|
constructor(private http: BaseHttpService, private configurationService: ConfigurationService) {
|
2019-01-18 18:03:45 +01:00
|
|
|
|
2020-03-26 17:44:12 +01:00
|
|
|
this.actionUrl = configurationService.server + 'dashboard/';
|
2019-01-18 18:03:45 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
search(like: string): Observable<SearchBarItem[]> {
|
|
|
|
return this.http.get<SearchBarItem[]>(this.actionUrl + 'search?like=' + like, { headers: this.headers });
|
|
|
|
}
|
|
|
|
}
|