Removed gold locally when user buys a card (#9736)

This commit is contained in:
Keith Holliday 2017-12-21 10:27:09 -06:00 committed by GitHub
parent a7617fa947
commit 95c99295c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View file

@ -393,7 +393,14 @@ export default {
}
},
async memberSelected (member) {
this.$store.dispatch('user:castSpell', {key: this.selectedSpellToBuy.key, targetId: member.id});
let castResult = await this.$store.dispatch('user:castSpell', {key: this.selectedSpellToBuy.key, targetId: member.id});
// Subtract gold for cards
if (this.selectedSpellToBuy.pinType === 'card') {
const newUserGp = castResult.data.data.user.stats.gp;
this.$store.state.user.data.stats.gp = newUserGp;
}
this.selectedSpellToBuy = null;
if (this.user.party._id) {

View file

@ -110,6 +110,7 @@ export function togglePinnedItem (store, params) {
export function castSpell (store, params) {
let spellUrl = `/api/v3/user/class/cast/${params.key}`;
if (params.targetId) spellUrl += `?targetId=${params.targetId}`;
return axios.post(spellUrl);