swithing user in status content works

This commit is contained in:
Shpuld Shpuldson 2020-07-23 12:33:45 +03:00
parent e785fbb3c3
commit 5edb7e76ff
1 changed files with 14 additions and 2 deletions

View File

@ -8,7 +8,8 @@ const UserPopover = {
data () {
return {
error: false,
fetching: false
fetching: false,
entered: false
}
},
computed: {
@ -24,8 +25,15 @@ const UserPopover = {
Popover: () => import('../popover/popover.vue'),
UserCard: () => import('../user_card/user_card.vue')
},
watch: {
userId (newValue, oldValue) {
if (this.entered) {
this.fetchUser()
}
}
},
methods: {
enter () {
fetchUser () {
if (!this.userId) return
if (this.fetching) return
const promises = []
@ -42,6 +50,10 @@ const UserPopover = {
.catch(e => (this.error = true))
.finally(() => (this.fetching = false))
}
},
enter () {
this.entered = true
this.fetchUser()
}
}
}