Skip to content

Commit

Permalink
Fix fetching the comments from invidious (FreeTubeApp#2721)
Browse files Browse the repository at this point in the history
  • Loading branch information
absidue authored Oct 15, 2022
1 parent 077fde7 commit 62c70fb
Showing 1 changed file with 14 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,7 @@ export default Vue.extend({
case 'invidious':
this.isLoading = true
this.commentData = []
this.getCommentDataInvidious({
resource: 'comments',
id: this.id,
params: {
continuation: this.nextPageToken,
sort_by: this.sortNewest ? 'new' : 'top'
}
})
this.getCommentDataInvidious()
break
}
},
Expand All @@ -128,14 +121,7 @@ export default Vue.extend({
})
break
case 'invidious':
this.getCommentDataInvidious({
resource: 'comments',
id: this.id,
params: {
continuation: this.nextPageToken,
sort_by: this.sortNewest ? 'new' : 'top'
}
})
this.getCommentDataInvidious()
break
}
},
Expand Down Expand Up @@ -184,14 +170,7 @@ export default Vue.extend({
})
if (this.backendFallback && this.backendPreference === 'local') {
showToast(this.$t('Falling back to Invidious API'))
this.getCommentDataInvidious({
resource: 'comments',
id: this.id,
params: {
continuation: this.nextPageToken,
sort_by: this.sortNewest ? 'new' : 'top'
}
})
this.getCommentDataInvidious()
} else {
this.isLoading = false
}
Expand All @@ -211,14 +190,7 @@ export default Vue.extend({
})
if (this.backendFallback && this.backendPreference === 'local') {
showToast(this.$t('Falling back to Invidious API'))
this.getCommentDataInvidious({
resource: 'comments',
id: this.id,
params: {
continuation: this.nextPageToken,
sort_by: this.sortNewest ? 'new' : 'top'
}
})
this.getCommentDataInvidious()
} else {
this.isLoading = false
}
Expand Down Expand Up @@ -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) => {
const commentData = response.comments.map((comment) => {
comment.showReplies = false
Expand Down

0 comments on commit 62c70fb

Please sign in to comment.