Use state object for user view instead of timeline.
Also fetch user if not in the state already.
This commit is contained in:
parent
55c4818084
commit
07057043d9
4 changed files with 21 additions and 2 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue