13046 - Fix creating challenge after cloning (#13048)

This commit is contained in:
Bart Enkelaar
2021-03-14 09:17:44 +01:00
committed by GitHub
parent 0e88ca0b92
commit 84d7df3d42
4 changed files with 10 additions and 4 deletions

View File

@@ -459,9 +459,16 @@ export default {
};
this.$root.$emit('bv::show::modal', 'challenge-modal');
});
this.$root.$on('habitica:create-challenge', () => {
this.cloning = false;
this.$store.state.challengeOptions.workingChallenge = {};
this.$root.$emit('bv::show::modal', 'challenge-modal');
});
},
beforeDestroy () {
this.$root.$off('habitica:clone-challenge');
this.$root.$off('habitica:update-challenge');
this.$root.$off('habitica:create-challenge');
},
methods: {
async shown () {

View File

@@ -193,7 +193,7 @@ export default {
this.loadChallenges();
},
createChallenge () {
this.$root.$emit('bv::show::modal', 'challenge-modal');
this.$root.$emit('habitica:create-challenge');
},
async loadChallenges () {
this.loading = true;

View File

@@ -114,7 +114,7 @@ export default {
this.challenges = await this.$store.dispatch('challenges:getGroupChallenges', { groupId: this.groupIdForChallenges });
},
createChallenge () {
this.$root.$emit('bv::show::modal', 'challenge-modal');
this.$root.$emit('habitica:create-challenge');
},
challengeCreated (challenge) {
if (challenge.group._id !== this.groupIdForChallenges) return;

View File

@@ -236,8 +236,7 @@ export default {
this.loadChallenges();
},
createChallenge () {
this.$store.state.challengeOptions.workingChallenge = {};
this.$root.$emit('bv::show::modal', 'challenge-modal');
this.$root.$emit('habitica:create-challenge');
},
async loadChallenges () {
this.loading = true;