2022-03-11 10:53:32 -08:00
|
|
|
import { HttpClient, HttpParams } from '@angular/common/http'
|
|
|
|
|
import { Injectable } from '@angular/core'
|
|
|
|
|
import { Observable } from 'rxjs'
|
|
|
|
|
import { map } from 'rxjs/operators'
|
|
|
|
|
import { environment } from 'src/environments/environment'
|
|
|
|
|
import { DocumentService } from './document.service'
|
2020-10-27 01:10:18 +01:00
|
|
|
|
|
|
|
|
@Injectable({
|
2022-03-11 10:53:32 -08:00
|
|
|
providedIn: 'root',
|
2020-10-27 01:10:18 +01:00
|
|
|
})
|
|
|
|
|
export class SearchService {
|
2022-03-11 10:53:32 -08:00
|
|
|
constructor(private http: HttpClient) {}
|
2020-10-27 17:05:14 +01:00
|
|
|
|
|
|
|
|
autocomplete(term: string): Observable<string[]> {
|
2022-03-11 10:53:32 -08:00
|
|
|
return this.http.get<string[]>(
|
|
|
|
|
`${environment.apiBaseUrl}search/autocomplete/`,
|
|
|
|
|
{ params: new HttpParams().set('term', term) }
|
|
|
|
|
)
|
2020-10-27 17:05:14 +01:00
|
|
|
}
|
2021-06-13 10:48:46 -04:00
|
|
|
}
|