Skip to content

Commit

Permalink
Catch and show error message
Browse files Browse the repository at this point in the history
Signed-off-by: Christopher Ng <chrng8@gmail.com>
  • Loading branch information
Pytal committed Jun 27, 2022
1 parent 0a770c6 commit b879e69
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions apps/comments/src/views/Comments.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ import { getCurrentUser } from '@nextcloud/auth'
import { loadState } from '@nextcloud/initial-state'
import axios from '@nextcloud/axios'
import { emit } from '@nextcloud/event-bus'
import { showError } from '@nextcloud/dialogs'
import VTooltip from 'v-tooltip'
import Vue from 'vue'

Expand Down Expand Up @@ -127,24 +128,28 @@ export default {

methods: {
/**
* Handle active tab focus
* Update current ressourceId and fetch new data
*
* @param {number} ressourceId the current ressourceId (fileId...)
*/
async active(ressourceId) {
await markCommentsAsRead(this.commentsType, ressourceId, new Date())
emit('comments:comments:read', { ressourceId: this.ressourceId })
async update(ressourceId) {
this.ressourceId = ressourceId
this.resetState()
this.getComments()
},

/**
* Update current ressourceId and fetch new data
* Handle active tab focus
*
* @param {number} ressourceId the current ressourceId (fileId...)
*/
async update(ressourceId) {
this.ressourceId = ressourceId
this.resetState()
this.getComments()
async active(ressourceId) {
try {
await markCommentsAsRead(this.commentsType, ressourceId, new Date())
emit('comments:comments:read', { ressourceId: this.ressourceId })
} catch (e) {
showError(e.message || t('comments', 'Error marking comments as read'))
}
},

/**
Expand Down

0 comments on commit b879e69

Please sign in to comment.