From 07057043d96cef9d3a0087f46fa4ff14a1f6788f Mon Sep 17 00:00:00 2001 From: eal Date: Tue, 14 Nov 2017 18:08:03 +0200 Subject: Use state object for user view instead of timeline. Also fetch user if not in the state already. --- src/components/user_profile/user_profile.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/components/user_profile/user_profile.js') diff --git a/src/components/user_profile/user_profile.js b/src/components/user_profile/user_profile.js index 48a8a073..26be1801 100644 --- a/src/components/user_profile/user_profile.js +++ b/src/components/user_profile/user_profile.js @@ -5,6 +5,9 @@ const UserProfile = { created () { this.$store.commit('clearTimeline', { timeline: 'user' }) this.$store.dispatch('startFetching', ['user', this.userId]) + if (!this.$store.state.users.usersObject[this.userId]) { + this.$store.dispatch('fetchUser', this.userId) + } }, destroyed () { this.$store.dispatch('stopFetching', 'user') @@ -18,7 +21,7 @@ const UserProfile = { if (this.timeline.statuses[0]) { return this.timeline.statuses[0].user } else { - return false + return this.$store.state.users.usersObject[this.userId] || false } } }, -- cgit v1.2.3-70-g09d2