From 5edb7e76ff4df41cd4413c6154f5838b738dcb7a Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Thu, 23 Jul 2020 12:33:45 +0300 Subject: [PATCH] swithing user in status content works --- src/components/user_popover/user_popover.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/components/user_popover/user_popover.js b/src/components/user_popover/user_popover.js index ab8d6107..7640c8a4 100644 --- a/src/components/user_popover/user_popover.js +++ b/src/components/user_popover/user_popover.js @@ -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() } } }