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) { |   invidiousGetChannelInfo ({ commit, dispatch }, channelId) { | ||||||
|     return new Promise((resolve, reject) => { |     return new Promise((resolve, reject) => { | ||||||
|       commit('toggleIsGetChannelInfoRunning') |       commit('toggleIsGetChannelInfoRunning') | ||||||
|  | @ -53,7 +43,6 @@ const actions = { | ||||||
|       }).catch((xhr) => { |       }).catch((xhr) => { | ||||||
|         console.log('found an error') |         console.log('found an error') | ||||||
|         console.log(xhr) |         console.log(xhr) | ||||||
|         dispatch('invidiousDefaultErrorHandler', xhr) |  | ||||||
|         commit('toggleIsGetChannelInfoRunning') |         commit('toggleIsGetChannelInfoRunning') | ||||||
|         reject(xhr) |         reject(xhr) | ||||||
|       }) |       }) | ||||||
|  | @ -67,7 +56,6 @@ const actions = { | ||||||
|       }).catch((xhr) => { |       }).catch((xhr) => { | ||||||
|         console.log('found an error') |         console.log('found an error') | ||||||
|         console.log(xhr) |         console.log(xhr) | ||||||
|         dispatch('invidiousDefaultErrorHandler', xhr) |  | ||||||
|         commit('toggleIsGetChannelInfoRunning') |         commit('toggleIsGetChannelInfoRunning') | ||||||
|         reject(xhr) |         reject(xhr) | ||||||
|       }) |       }) | ||||||
|  | @ -87,7 +75,6 @@ const actions = { | ||||||
|       }).catch((xhr) => { |       }).catch((xhr) => { | ||||||
|         console.log('found an error') |         console.log('found an error') | ||||||
|         console.log(xhr) |         console.log(xhr) | ||||||
|         dispatch('invidiousDefaultErrorHandler', xhr) |  | ||||||
|         reject(xhr) |         reject(xhr) | ||||||
|       }) |       }) | ||||||
|     }) |     }) | ||||||
|  |  | ||||||
|  | @ -427,7 +427,7 @@ export default Vue.extend({ | ||||||
|             } |             } | ||||||
|           }) |           }) | ||||||
|           console.log(err) |           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({ |             this.showToast({ | ||||||
|               message: this.$t('Falling back to Invidious API') |               message: this.$t('Falling back to Invidious API') | ||||||
|             }) |             }) | ||||||
|  | @ -580,16 +580,17 @@ export default Vue.extend({ | ||||||
|             } |             } | ||||||
|           } |           } | ||||||
| 
 | 
 | ||||||
|           this.isLoading = false |  | ||||||
|           this.updateTitle() |           this.updateTitle() | ||||||
|  | 
 | ||||||
|  |           this.isLoading = false | ||||||
|         }) |         }) | ||||||
|         .catch(err => { |         .catch(err => { | ||||||
|           const errorMessage = this.$t('Invidious API Error (Click to copy)') |           const errorMessage = this.$t('Invidious API Error (Click to copy)') | ||||||
|           this.showToast({ |           this.showToast({ | ||||||
|             message: `${errorMessage}: ${err}`, |             message: `${errorMessage}: ${err.responseText}`, | ||||||
|             time: 10000, |             time: 10000, | ||||||
|             action: () => { |             action: () => { | ||||||
|               navigator.clipboard.writeText(err) |               navigator.clipboard.writeText(err.responseText) | ||||||
|             } |             } | ||||||
|           }) |           }) | ||||||
|           console.log(err) |           console.log(err) | ||||||
|  | @ -600,7 +601,6 @@ export default Vue.extend({ | ||||||
|             this.getVideoInformationLocal() |             this.getVideoInformationLocal() | ||||||
|           } else { |           } else { | ||||||
|             this.isLoading = false |             this.isLoading = false | ||||||
|             // TODO: Show toast with error message
 |  | ||||||
|           } |           } | ||||||
|         }) |         }) | ||||||
|     }, |     }, | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue