fix(profile): correctly change page title when closing profile modal, fixes #12760, thanks @aevix

This commit is contained in:
Matteo Pagliazzi
2020-11-16 11:29:48 +01:00
parent d0c9c2917f
commit df1e4af7fc
2 changed files with 18 additions and 0 deletions

View File

@@ -776,6 +776,7 @@ export default {
content: Content,
user: null,
userLoaded: false,
oldTitle: null,
};
},
computed: {
@@ -831,7 +832,18 @@ export default {
},
mounted () {
this.loadUser();
this.oldTitle = this.$store.state.title;
this.selectPage(this.startingPage);
this.$root.$on('habitica:restoreTitle', () => {
if (this.oldTitle) {
this.$store.dispatch('common:setTitle', {
fullTitle: this.oldTitle,
});
}
});
},
beforeDestroy () {
this.$root.$off('habitica:restoreTitle');
},
methods: {
async loadUser () {