mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
Fix edit challenge twice bug (#11591)
Description: Use of a same object property group for differents types between a challenge and workingChallenge workingChallenge use group as and id but this.challenge have a group object Fix: Wait for server response for challenge edit. Set this.challenge from response and not directly from form data workingChallenge
This commit is contained in:
@@ -595,7 +595,7 @@ export default {
|
||||
this.$root.$emit('bv::hide::modal', 'challenge-modal');
|
||||
this.$router.push(`/challenges/${challenge._id}`);
|
||||
},
|
||||
updateChallenge () {
|
||||
async updateChallenge () {
|
||||
const categoryKeys = this.workingChallenge.categories;
|
||||
const serverCategories = [];
|
||||
categoryKeys.forEach(key => {
|
||||
@@ -610,10 +610,8 @@ export default {
|
||||
const challengeDetails = clone(this.workingChallenge);
|
||||
challengeDetails.categories = serverCategories;
|
||||
|
||||
this.$emit('updatedChallenge', {
|
||||
challenge: challengeDetails,
|
||||
});
|
||||
this.$store.dispatch('challenges:updateChallenge', { challenge: challengeDetails });
|
||||
const challenge = await this.$store.dispatch('challenges:updateChallenge', { challenge: challengeDetails });
|
||||
this.$emit('updatedChallenge', { challenge });
|
||||
this.resetWorkingChallenge();
|
||||
this.$root.$emit('bv::hide::modal', 'challenge-modal');
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user