Update title in beforeDestroy() (#14408)

This commit is contained in:
Patrick Delaney
2022-12-15 20:48:08 +00:00
committed by GitHub
parent 42e0bad4ac
commit 7309ab4fd4
2 changed files with 8 additions and 15 deletions
@@ -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>