From 54fa1d59084d4eb2910d2072b287095e10a6968c Mon Sep 17 00:00:00 2001 From: Davide Alberani Date: Tue, 31 Jan 2017 22:51:09 +0100 Subject: [PATCH] fixes #23: go to logged in user page from another one (for admins) --- src/User.vue | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/User.vue b/src/User.vue index 57ab43a..fea5b97 100644 --- a/src/User.vue +++ b/src/User.vue @@ -34,7 +34,7 @@ import IbtSnackbar from './IbtSnackbar.vue'; export default { data () { return { - user: {email: '', password: null, isAdmin: false}, + user: {_id: null, email: '', password: null, isAdmin: false}, password: null } }, @@ -50,6 +50,12 @@ export default { }, mounted: function() { + this.$router.afterEach((to, from) => { + if (this.user._id && this.user._id != this.$route.params.id && + to.name == from.name && to.name == 'user') { + this.getUser(this.$route.params.id); + } + }); this.getUser(this.$route.params.id); },