mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 06:37:23 +01:00
fix(profile): correctly change page title when closing profile modal, fixes #12760, thanks @aevix
This commit is contained in:
@@ -776,6 +776,7 @@ export default {
|
|||||||
content: Content,
|
content: Content,
|
||||||
user: null,
|
user: null,
|
||||||
userLoaded: false,
|
userLoaded: false,
|
||||||
|
oldTitle: null,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -831,7 +832,18 @@ export default {
|
|||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
this.loadUser();
|
this.loadUser();
|
||||||
|
this.oldTitle = this.$store.state.title;
|
||||||
this.selectPage(this.startingPage);
|
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: {
|
methods: {
|
||||||
async loadUser () {
|
async loadUser () {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
size="lg"
|
size="lg"
|
||||||
:hide-footer="true"
|
:hide-footer="true"
|
||||||
:hide-header="true"
|
:hide-header="true"
|
||||||
|
@hide="beforeHide"
|
||||||
@hidden="onHidden"
|
@hidden="onHidden"
|
||||||
@shown="onShown()"
|
@shown="onShown()"
|
||||||
>
|
>
|
||||||
@@ -52,6 +53,11 @@ export default {
|
|||||||
onShown () {
|
onShown () {
|
||||||
window.history.pushState('', null, this.path);
|
window.history.pushState('', null, this.path);
|
||||||
},
|
},
|
||||||
|
beforeHide () {
|
||||||
|
if (this.$route.path !== window.location.pathname) {
|
||||||
|
this.$root.$emit('habitica:restoreTitle');
|
||||||
|
}
|
||||||
|
},
|
||||||
onHidden () {
|
onHidden () {
|
||||||
if (this.$route.path !== window.location.pathname) {
|
if (this.$route.path !== window.location.pathname) {
|
||||||
this.$router.go(-1);
|
this.$router.go(-1);
|
||||||
|
|||||||
Reference in New Issue
Block a user