From 2482cbb1b3ee2308db7b26a16dbe0b56d797b482 Mon Sep 17 00:00:00 2001 From: Daniel Martin Date: Tue, 2 Feb 2021 02:27:51 +0000 Subject: [PATCH] Fix api calls for new search option api --- .../search-options/search-options.component.ts | 15 ++++++++++----- src/app/openlp.service.ts | 4 ++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/app/components/search/search-options/search-options.component.ts b/src/app/components/search/search-options/search-options.component.ts index 639ef51..7bfcd9a 100644 --- a/src/app/components/search/search-options/search-options.component.ts +++ b/src/app/components/search/search-options/search-options.component.ts @@ -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; } } diff --git a/src/app/openlp.service.ts b/src/app/openlp.service.ts index 0ee44f8..5f7033a 100644 --- a/src/app/openlp.service.ts +++ b/src/app/openlp.service.ts @@ -89,8 +89,8 @@ export class OpenLPService { return this.http.get(`${this.apiURL}/plugins/${plugin}/search-options`, httpOptions); } - setSearchOption(plugin, option): Observable { - return this.http.post(`${this.apiURL}/plugins/${plugin}/search-options`, {'option': option}, httpOptions); + setSearchOption(plugin, option, value): Observable { + return this.http.post(`${this.apiURL}/plugins/${plugin}/search-options`, {'option': option, 'value': value}, httpOptions); } getServiceItems(): Observable {