Skip to content

Commit

Permalink
依存関係にあった関数を1つにした
Browse files Browse the repository at this point in the history
  • Loading branch information
kei-kmj committed Aug 12, 2022
1 parent 2c72c32 commit 047aa79
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions app/javascript/comments.vue
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,12 @@ export default {
changeActiveTab(tab) {
this.tab = tab
},
calcCommentIncrement: function () {
DisplayMoreComments: function () {
this.loadedComment =
this.commentLimit + this.commentOffset >= this.commentTotalCount
if (!this.loadedComment) {
this.commentOffset += this.commentLimit
}
},
showNextCommentsAmount: function () {
const commentRemaining = this.commentTotalCount - this.commentOffset
if (commentRemaining > this.incrementCommentSize) {
Expand Down Expand Up @@ -190,6 +188,7 @@ export default {
this.comments.unshift(c)
})
this.commentTotalCount = json.comment_total_count
this.DisplayMoreComments()
})
.catch((error) => {
console.warn(error)
Expand All @@ -202,8 +201,6 @@ export default {
this.setDefaultTextareaSize()
})
}
this.calcCommentIncrement()
this.showNextCommentsAmount()
})
},
createComment() {
Expand Down

0 comments on commit 047aa79

Please sign in to comment.