Add Error handling for search suggestions

This commit is contained in:
Preston 2020-06-01 22:46:11 -04:00
parent c8da6fec3d
commit 42046a00de
1 changed files with 12 additions and 0 deletions

View File

@ -127,6 +127,12 @@ export default Vue.extend({
ytSuggest(query).then((results) => {
this.searchSuggestionsDataList = results
this.searchValue = query
}).error((err) => {
console.log(err)
if (this.backendFallback) {
console.log('Error gettings search suggestions. Falling back to Invidious API')
this.getSearchSuggestionsInvidious(query)
}
})
},
@ -148,6 +154,12 @@ export default Vue.extend({
this.$store.dispatch('invidiousAPICall', searchPayload).then((results) => {
this.searchSuggestionsDataList = results.suggestions
this.searchValue = query
}).error((err) => {
console.log(err)
if (this.backendFallback) {
console.log('Error gettings search suggestions. Falling back to Local API')
this.getSearchSuggestionsLocal(query)
}
})
},