Fix Invidious Fallback logic
This commit is contained in:
parent
3c8dfb84b5
commit
de3cff57c5
|
@ -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)
|
||||
})
|
||||
})
|
||||
|
|
|
@ -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
|
||||
}
|
||||
})
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue