akkoma-fe/src/components/status_popover/status_popover.js

38 lines
748 B
JavaScript
Raw Normal View History

import { find } from 'lodash'
const StatusPopover = {
name: 'StatusPopover',
props: [
'statusId'
],
data () {
return {
error: false
}
},
2019-10-25 02:14:53 +00:00
computed: {
status () {
return find(this.$store.state.statuses.allStatuses, { id: this.statusId })
}
},
components: {
2020-02-28 16:39:47 +00:00
Status: () => import('../status/status.vue'),
Popover: () => import('../popover/popover.vue')
},
methods: {
enter () {
2019-10-25 02:14:53 +00:00
if (!this.status) {
if (!this.statusId) {
this.error = true
return
}
2019-10-25 02:21:33 +00:00
this.$store.dispatch('fetchStatus', this.statusId)
.then(data => (this.error = false))
.catch(e => (this.error = true))
}
}
}
}
export default StatusPopover