feat: master search tool and page (#1190)

Fixes: #1189
This commit is contained in:
Karan Takalkar
2020-08-10 16:49:46 +05:30
committed by GitHub
parent a27169d8fe
commit bc57a061c4
17 changed files with 426 additions and 38 deletions
+34
View File
@@ -0,0 +1,34 @@
/** Angular Imports */
import { Injectable } from '@angular/core';
import { HttpClient, HttpParams } from '@angular/common/http';
/** rxjs Imports */
import { Observable } from 'rxjs';
/**
* Search service.
*/
@Injectable({
providedIn: 'root'
})
export class SearchService {
/**
* @param {HttpClient} http Http Client to send requests.
*/
constructor(private http: HttpClient) { }
/**
* @param {string} query Query String
* @param {string} resource Entity resource
* @returns {Observable<any>} Search Results.
*/
getSearchResults(query: string, resource: string): Observable<any> {
const httpParams = new HttpParams()
.set('exactMatch', 'false')
.set('query', query)
.set('resource', resource);
return this.http.get('/search', { params: httpParams });
}
}