Update title in beforeDestroy() (#14408)
This commit is contained in:
@@ -863,16 +863,13 @@ export default {
|
||||
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');
|
||||
if (this.oldTitle) {
|
||||
this.$store.dispatch('common:setTitle', {
|
||||
fullTitle: this.oldTitle,
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async loadUser () {
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
:hide-footer="true"
|
||||
:hide-header="true"
|
||||
@hide="beforeHide"
|
||||
@hidden="onHidden"
|
||||
@shown="onShown()"
|
||||
>
|
||||
<profile
|
||||
@@ -55,14 +54,11 @@ export default {
|
||||
},
|
||||
beforeHide () {
|
||||
if (this.$route.path !== window.location.pathname) {
|
||||
this.$root.$emit('habitica:restoreTitle');
|
||||
}
|
||||
},
|
||||
onHidden () {
|
||||
if (this.$route.path !== window.location.pathname) {
|
||||
this.$router.go(-1);
|
||||
this.$router.back();
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user