Fix api calls for new search option api

This commit is contained in:
Daniel Martin 2021-02-02 02:27:51 +00:00 committed by Raoul Snyman
parent 2812e383e6
commit 2482cbb1b3
2 changed files with 12 additions and 7 deletions

View File

@ -28,14 +28,19 @@ export class SearchOptionsComponent {
getSearchOptions() {
this.openlpService.getSearchOptions(this.selectedPlugin).subscribe(res => {
if (this.selectedPlugin === 'bibles') {
this.searchOptions = res['bibles'];
this.selectedSearchOption = res['primary'];
for (const option of res) {
if (option.name === 'primary bible') {
this.searchOptions = option['list'];
this.selectedSearchOption = option['selected'];
break;
}
}
}
});
}
setSearchOption(option) {
this.openlpService.setSearchOption(this.selectedPlugin, option.value).subscribe(res => {});
this.selectedSearchOption = option.value;
setSearchOption(target) {
this.openlpService.setSearchOption(this.selectedPlugin, 'primary bible', target.value).subscribe(res => {});
this.selectedSearchOption = target.value;
}
}

View File

@ -89,8 +89,8 @@ export class OpenLPService {
return this.http.get(`${this.apiURL}/plugins/${plugin}/search-options`, httpOptions);
}
setSearchOption(plugin, option): Observable<any> {
return this.http.post(`${this.apiURL}/plugins/${plugin}/search-options`, {'option': option}, httpOptions);
setSearchOption(plugin, option, value): Observable<any> {
return this.http.post(`${this.apiURL}/plugins/${plugin}/search-options`, {'option': option, 'value': value}, httpOptions);
}
getServiceItems(): Observable<ServiceItem[]> {