fix(modals): better stack???

This commit is contained in:
Sabe Jones
2018-11-02 14:58:32 -05:00
parent f871c7cf63
commit 818d5e4eb6

View File

@@ -317,18 +317,12 @@ export default {
this.$store.dispatch('user:fetch'),
this.$store.dispatch('tasks:fetchUserTasks'),
]).then(() => {
this.debounceCheckUserAchievements();
// @TODO: This is a timeout to ensure dom is loaded
window.setTimeout(() => {
this.initTour();
if (this.user.flags.tour.intro === this.TOUR_END || !this.user.flags.welcomed) return;
this.goto('intro', 0);
this.runForcedModals();
}, 2000);
this.forceVerifyUsername();
this.runYesterDailies();
this.debounceCheckUserAchievements();
// Do not remove the event listener as it's live for the entire app lifetime
document.addEventListener('mousemove', this.checkNextCron);
@@ -344,6 +338,14 @@ export default {
document.removeEventListener('keydown', this.checkNextCron);
},
methods: {
runForcedModals () {
if (!this.user.flags.verifiedUsername) return this.$root.$emit('bv::show::modal', 'verify-username');
this.initTour();
if (!(this.user.flags.tour.intro === this.TOUR_END || !this.user.flags.welcomed)) return this.goto('intro', 0);
return this.runYesterDailies();
},
showDeathModal () {
this.playSound('Death');
this.$root.$emit('bv::show::modal', 'death');
@@ -471,11 +473,6 @@ export default {
this.nextCron = Number(nextCron.format('x'));
this.$store.state.isRunningYesterdailies = false;
},
forceVerifyUsername () {
if (this.user.flags.verifiedUsername) return;
this.$root.$emit('bv::show::modal', 'verify-username');
},
async runYesterDailies () {
if (this.$store.state.isRunningYesterdailies) return;
this.$store.state.isRunningYesterdailies = true;