Added habitica event for profile display (#9576)

This commit is contained in:
Keith Holliday
2017-11-27 10:29:20 -06:00
committed by GitHub
parent ea5ba965e7
commit 3e6b3ce3ff
8 changed files with 46 additions and 21 deletions

View File

@@ -631,6 +631,18 @@ export default {
},
};
},
mounted () {
this.$root.$on('habitica:show-profile', (data) => {
if (!data.user || !data.startingPage) return;
// @TODO: We may be able to remove the need for store
this.$store.state.profileUser = data.user;
this.$store.state.profileOptions.startingPage = data.startingPage;
this.$root.$emit('bv::show::modal', 'profile');
});
},
destroyed () {
this.$root.$off('habitica:show-profile');
},
computed: {
...mapState({
userLoggedIn: 'user.data',