fixes #23: go to logged in user page from another one (for admins)

This commit is contained in:
Davide Alberani 2017-01-31 22:51:09 +01:00
parent 17e0164fa0
commit 54fa1d5908

View file

@ -34,7 +34,7 @@ import IbtSnackbar from './IbtSnackbar.vue';
export default { export default {
data () { data () {
return { return {
user: {email: '', password: null, isAdmin: false}, user: {_id: null, email: '', password: null, isAdmin: false},
password: null password: null
} }
}, },
@ -50,6 +50,12 @@ export default {
}, },
mounted: function() { 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); this.getUser(this.$route.params.id);
}, },