Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show error message in most popular page when instance does not support it #3841

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/renderer/views/Popular/Popular.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 { invidiousAPICall } from '../../helpers/api/invidious'
import { copyToClipboard, showToast } from '../../helpers/utils'

export default defineComponent({
name: 'Popular',
Expand All @@ -28,7 +29,7 @@ export default defineComponent({
mounted: function () {
document.addEventListener('keydown', this.keyboardShortcutHandler)

this.shownResults = this.popularCache
this.shownResults = this.popularCache || []
if (!this.shownResults || this.shownResults.length < 1) {
this.fetchPopularInfo()
}
Expand All @@ -47,7 +48,11 @@ export default defineComponent({
this.isLoading = true
const result = await invidiousAPICall(searchPayload)
.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) {
Expand Down