Fix fetching the comments from invidious (#2721)

This commit is contained in:
absidue 2022-10-15 06:01:58 +02:00 committed by GitHub
parent 077fde70f1
commit 62c70fbdd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 33 deletions

View File

@ -104,14 +104,7 @@ export default Vue.extend({
case 'invidious': case 'invidious':
this.isLoading = true this.isLoading = true
this.commentData = [] this.commentData = []
this.getCommentDataInvidious({ this.getCommentDataInvidious()
resource: 'comments',
id: this.id,
params: {
continuation: this.nextPageToken,
sort_by: this.sortNewest ? 'new' : 'top'
}
})
break break
} }
}, },
@ -128,14 +121,7 @@ export default Vue.extend({
}) })
break break
case 'invidious': case 'invidious':
this.getCommentDataInvidious({ this.getCommentDataInvidious()
resource: 'comments',
id: this.id,
params: {
continuation: this.nextPageToken,
sort_by: this.sortNewest ? 'new' : 'top'
}
})
break break
} }
}, },
@ -184,14 +170,7 @@ export default Vue.extend({
}) })
if (this.backendFallback && this.backendPreference === 'local') { if (this.backendFallback && this.backendPreference === 'local') {
showToast(this.$t('Falling back to Invidious API')) showToast(this.$t('Falling back to Invidious API'))
this.getCommentDataInvidious({ this.getCommentDataInvidious()
resource: 'comments',
id: this.id,
params: {
continuation: this.nextPageToken,
sort_by: this.sortNewest ? 'new' : 'top'
}
})
} else { } else {
this.isLoading = false this.isLoading = false
} }
@ -211,14 +190,7 @@ export default Vue.extend({
}) })
if (this.backendFallback && this.backendPreference === 'local') { if (this.backendFallback && this.backendPreference === 'local') {
showToast(this.$t('Falling back to Invidious API')) showToast(this.$t('Falling back to Invidious API'))
this.getCommentDataInvidious({ this.getCommentDataInvidious()
resource: 'comments',
id: this.id,
params: {
continuation: this.nextPageToken,
sort_by: this.sortNewest ? 'new' : 'top'
}
})
} else { } else {
this.isLoading = false this.isLoading = false
} }
@ -274,7 +246,16 @@ export default Vue.extend({
} }
}, },
getCommentDataInvidious: function (payload) { getCommentDataInvidious: function () {
const payload = {
resource: 'comments',
id: this.id,
params: {
continuation: this.nextPageToken ?? '',
sort_by: this.sortNewest ? 'new' : 'top'
}
}
this.invidiousAPICall(payload).then((response) => { this.invidiousAPICall(payload).then((response) => {
const commentData = response.comments.map((comment) => { const commentData = response.comments.map((comment) => {
comment.showReplies = false comment.showReplies = false