Challenge modal optimization - remove unnecessary API call - partial fix for #9371 (#9546)

* Attempt to use party data from the store rather than always fetching it from the API

* Move init code to shown() to prevent unnecessary network requests

* Use store party data in getGroup action if possible to save an API call

* Use store data rather than API call for party in challengeModal; remove unnecessary code in guilds:getGroup action

* Create party:getParty action and employ it in Group and ChallengeModal

* Use store instead of action return for party data

* Change how party data is stored
This commit is contained in:
Grayson Gilmore
2018-01-12 14:18:56 -08:00
committed by Sabe Jones
parent 183c90ac3a
commit ce14a9dadb
10 changed files with 46 additions and 37 deletions

View File

@@ -538,16 +538,14 @@ export default {
return;
}
let group = await this.$store.dispatch('guilds:getGroup', {groupId: this.searchId});
if (this.isParty) {
this.$store.state.party.data = group;
await this.$store.dispatch('party:getParty');
this.group = this.$store.state.party.data;
this.checkForAchievements();
return;
} else {
const group = await this.$store.dispatch('guilds:getGroup', {groupId: this.searchId});
this.$set(this, 'group', group);
}
this.$set(this, 'group', group);
},
deleteAllMessages () {
if (confirm(this.$t('confirmDeleteAllMessages'))) {