1
0
mirror of https://gitlab.com/bramw/baserow.git synced 2024-11-21 23:37:55 +00:00
bramw_baserow/web-frontend/modules/core/mixins/notificationContent.js

48 lines
955 B
JavaScript

import { notifyIf } from '@baserow/modules/core/utils/error'
export default {
props: {
workspace: {
type: Object,
required: true,
},
notification: {
type: Object,
required: true,
},
},
computed: {
route() {
return this.$registry
.get('notification', this.notification.type)
.getRoute(this.notification.data)
},
sender() {
return this.notification.sender?.first_name
},
},
methods: {
markAsReadAndHandleClick(evt) {
this.$emit('click')
this.markAsRead()
if (typeof this.handleClick === 'function') {
this.handleClick(evt)
}
},
async markAsRead() {
const notification = this.notification
if (notification.read) {
return
}
try {
await this.$store.dispatch('notification/markAsRead', { notification })
} catch (err) {
notifyIf(err, 'error')
}
},
},
}