mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-08-01 11:40:25 +00:00
Removed gold locally when user buys a card (#9736)
This commit is contained in:
parent
a7617fa947
commit
95c99295c1
2 changed files with 9 additions and 1 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue