mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 06:07:21 +01:00
reload page if the user closes the modal or not clicking on the notification
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
<template lang="pug">
|
<template lang="pug">
|
||||||
b-modal#rebirth(:title="$t('modalAchievement')", size='md', :hide-footer="true")
|
b-modal#rebirth(:title="$t('modalAchievement')", size='md', :hide-footer="true", @hidden="reloadPage()")
|
||||||
.modal-body
|
.modal-body
|
||||||
.col-12
|
.col-12
|
||||||
// @TODO: +achievementAvatar('sun',0)
|
// @TODO: +achievementAvatar('sun',0)
|
||||||
@@ -24,23 +24,26 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import achievementFooter from './achievementFooter';
|
import achievementFooter from './achievementFooter';
|
||||||
import achievementAvatar from './achievementAvatar';
|
import achievementAvatar from './achievementAvatar';
|
||||||
|
|
||||||
import { mapState } from 'client/libs/store';
|
import {mapState} from 'client/libs/store';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
achievementFooter,
|
achievementFooter,
|
||||||
achievementAvatar,
|
achievementAvatar,
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
...mapState({user: 'user.data'}),
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
close () {
|
|
||||||
this.$root.$emit('bv::hide::modal', 'rebirth');
|
|
||||||
},
|
},
|
||||||
},
|
computed: {
|
||||||
};
|
...mapState({user: 'user.data'}),
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
close () {
|
||||||
|
this.$root.$emit('bv::hide::modal', 'rebirth');
|
||||||
|
},
|
||||||
|
reloadPage () {
|
||||||
|
window.location.reload(true);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -363,7 +363,18 @@ export default {
|
|||||||
this.playSound(config.sound);
|
this.playSound(config.sound);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (forceToModal) {
|
if (type === 'REBIRTH_ACHIEVEMENT') {
|
||||||
|
// reload if the user hasn't clicked on the notification
|
||||||
|
const timeOut = setTimeout(() => {
|
||||||
|
window.location.reload(true);
|
||||||
|
}, 60000);
|
||||||
|
|
||||||
|
this.text(config.label(this.$t), () => {
|
||||||
|
// prevent the current reload timeout
|
||||||
|
clearTimeout(timeOut);
|
||||||
|
this.$root.$emit('bv::show::modal', config.modalId);
|
||||||
|
}, false);
|
||||||
|
} else if (forceToModal) {
|
||||||
this.$root.$emit('bv::show::modal', config.modalId);
|
this.$root.$emit('bv::show::modal', config.modalId);
|
||||||
} else {
|
} else {
|
||||||
this.text(config.label(this.$t), () => {
|
this.text(config.label(this.$t), () => {
|
||||||
|
|||||||
@@ -139,8 +139,6 @@ export function newStuffLater (store) {
|
|||||||
export async function rebirth () {
|
export async function rebirth () {
|
||||||
let result = await axios.post('/api/v4/user/rebirth');
|
let result = await axios.post('/api/v4/user/rebirth');
|
||||||
|
|
||||||
window.location.reload(true);
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user