From 6532462b95fbea1a19508fcdfa50df02b083b657 Mon Sep 17 00:00:00 2001 From: Maxim Filippov Date: Thu, 6 Dec 2018 04:05:35 +0300 Subject: Move old routes to /p, use /nickname for user profiles --- src/components/user_profile/user_profile.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (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 1d79713d..d7e19b36 100644 --- a/src/components/user_profile/user_profile.js +++ b/src/components/user_profile/user_profile.js @@ -15,18 +15,23 @@ const UserProfile = { computed: { timeline () { return this.$store.state.statuses.timelines.user }, userId () { - return this.$route.params.id + return this.user.id + }, + userName () { + return this.$route.params.name }, user () { if (this.timeline.statuses[0]) { return this.timeline.statuses[0].user } else { - return this.$store.state.users.usersObject[this.userId] || false + return Object.values(this.$store.state.users.usersObject).filter(user => { + return user.name === this.userName + })[0] || false } } }, watch: { - userId () { + userName () { this.$store.dispatch('stopFetching', 'user') this.$store.commit('clearTimeline', { timeline: 'user' }) this.$store.dispatch('startFetching', ['user', this.userId]) -- cgit v1.2.3-70-g09d2