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