2019-10-25 07:53:36 +11:00
|
|
|
import { find } from 'lodash'
|
|
|
|
|
|
|
|
const StatusPopover = {
|
|
|
|
name: 'StatusPopover',
|
|
|
|
props: [
|
|
|
|
'statusId'
|
|
|
|
],
|
2020-03-02 17:35:57 +11:00
|
|
|
data () {
|
|
|
|
return {
|
|
|
|
error: false
|
|
|
|
}
|
|
|
|
},
|
2019-10-25 13:14:53 +11:00
|
|
|
computed: {
|
|
|
|
status () {
|
|
|
|
return find(this.$store.state.statuses.allStatuses, { id: this.statusId })
|
|
|
|
}
|
|
|
|
},
|
2019-10-25 07:53:36 +11:00
|
|
|
components: {
|
2020-02-29 03:39:47 +11:00
|
|
|
Status: () => import('../status/status.vue'),
|
|
|
|
Popover: () => import('../popover/popover.vue')
|
2019-10-25 07:53:36 +11:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
enter () {
|
2019-10-25 13:14:53 +11:00
|
|
|
if (!this.status) {
|
2020-06-30 22:15:27 +10:00
|
|
|
if (!this.statusId) {
|
|
|
|
this.error = true
|
|
|
|
return
|
|
|
|
}
|
2019-10-25 13:21:33 +11:00
|
|
|
this.$store.dispatch('fetchStatus', this.statusId)
|
2020-03-02 17:35:57 +11:00
|
|
|
.then(data => (this.error = false))
|
|
|
|
.catch(e => (this.error = true))
|
2019-10-25 07:53:36 +11:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default StatusPopover
|