From de3cff57c52c6a478e5dcbc5b33d3da796fb85fd Mon Sep 17 00:00:00 2001 From: Preston Date: Sat, 31 Oct 2020 11:23:26 -0400 Subject: [PATCH] Fix Invidious Fallback logic --- src/renderer/store/modules/invidious.js | 13 ------------- src/renderer/views/Watch/Watch.js | 10 +++++----- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/src/renderer/store/modules/invidious.js b/src/renderer/store/modules/invidious.js index 65025128..e69f968e 100644 --- a/src/renderer/store/modules/invidious.js +++ b/src/renderer/store/modules/invidious.js @@ -28,16 +28,6 @@ const actions = { }) }, - /* eslint-disable-next-line */ - invidiousDefaultErrorHandler({}, xhr) { - if (typeof (xhr.responseJSON.error) !== 'undefined') { - console.log('Invidious API Error: ' + xhr.responseJSON.error) - } else { - console.log('There was an error calling the Invidious API') - console.log(xhr) - } - }, - invidiousGetChannelInfo ({ commit, dispatch }, channelId) { return new Promise((resolve, reject) => { commit('toggleIsGetChannelInfoRunning') @@ -53,7 +43,6 @@ const actions = { }).catch((xhr) => { console.log('found an error') console.log(xhr) - dispatch('invidiousDefaultErrorHandler', xhr) commit('toggleIsGetChannelInfoRunning') reject(xhr) }) @@ -67,7 +56,6 @@ const actions = { }).catch((xhr) => { console.log('found an error') console.log(xhr) - dispatch('invidiousDefaultErrorHandler', xhr) commit('toggleIsGetChannelInfoRunning') reject(xhr) }) @@ -87,7 +75,6 @@ const actions = { }).catch((xhr) => { console.log('found an error') console.log(xhr) - dispatch('invidiousDefaultErrorHandler', xhr) reject(xhr) }) }) diff --git a/src/renderer/views/Watch/Watch.js b/src/renderer/views/Watch/Watch.js index 2aefcf91..aba94c83 100644 --- a/src/renderer/views/Watch/Watch.js +++ b/src/renderer/views/Watch/Watch.js @@ -427,7 +427,7 @@ export default Vue.extend({ } }) console.log(err) - if (!this.usingElectron || (this.backendPreference === 'local' && this.backendFallback && !err.includes('private'))) { + if (!this.usingElectron || (this.backendPreference === 'local' && this.backendFallback && !err.toString().includes('private'))) { this.showToast({ message: this.$t('Falling back to Invidious API') }) @@ -580,16 +580,17 @@ export default Vue.extend({ } } - this.isLoading = false this.updateTitle() + + this.isLoading = false }) .catch(err => { const errorMessage = this.$t('Invidious API Error (Click to copy)') this.showToast({ - message: `${errorMessage}: ${err}`, + message: `${errorMessage}: ${err.responseText}`, time: 10000, action: () => { - navigator.clipboard.writeText(err) + navigator.clipboard.writeText(err.responseText) } }) console.log(err) @@ -600,7 +601,6 @@ export default Vue.extend({ this.getVideoInformationLocal() } else { this.isLoading = false - // TODO: Show toast with error message } }) },