mirror of https://github.com/FreeTubeApp/FreeTube
* Show error message in popular tab when instance does not support it (#3841)
This commit is contained in:
parent
8d9a1b8952
commit
51576a9563
|
@ -5,6 +5,7 @@ import FtElementList from '../../components/ft-element-list/ft-element-list.vue'
|
||||||
import FtIconButton from '../../components/ft-icon-button/ft-icon-button.vue'
|
import FtIconButton from '../../components/ft-icon-button/ft-icon-button.vue'
|
||||||
|
|
||||||
import { invidiousAPICall } from '../../helpers/api/invidious'
|
import { invidiousAPICall } from '../../helpers/api/invidious'
|
||||||
|
import { copyToClipboard, showToast } from '../../helpers/utils'
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'Popular',
|
name: 'Popular',
|
||||||
|
@ -28,7 +29,7 @@ export default defineComponent({
|
||||||
mounted: function () {
|
mounted: function () {
|
||||||
document.addEventListener('keydown', this.keyboardShortcutHandler)
|
document.addEventListener('keydown', this.keyboardShortcutHandler)
|
||||||
|
|
||||||
this.shownResults = this.popularCache
|
this.shownResults = this.popularCache || []
|
||||||
if (!this.shownResults || this.shownResults.length < 1) {
|
if (!this.shownResults || this.shownResults.length < 1) {
|
||||||
this.fetchPopularInfo()
|
this.fetchPopularInfo()
|
||||||
}
|
}
|
||||||
|
@ -47,7 +48,11 @@ export default defineComponent({
|
||||||
this.isLoading = true
|
this.isLoading = true
|
||||||
const result = await invidiousAPICall(searchPayload)
|
const result = await invidiousAPICall(searchPayload)
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.error(err)
|
const errorMessage = this.$t('Invidious API Error (Click to copy)')
|
||||||
|
showToast(`${errorMessage}: ${err}`, 10000, () => {
|
||||||
|
copyToClipboard(err)
|
||||||
|
})
|
||||||
|
return undefined
|
||||||
})
|
})
|
||||||
|
|
||||||
if (!result) {
|
if (!result) {
|
||||||
|
|
Loading…
Reference in New Issue