mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-08-02 04:00:36 +00:00
check genericPurchase rejections and show error (#10526)
This commit is contained in:
parent
284b2cc413
commit
b7a46637d5
1 changed files with 22 additions and 8 deletions
|
|
@ -1,13 +1,27 @@
|
|||
export default {
|
||||
methods: {
|
||||
makeGenericPurchase (item, type = 'buyModal', quantity = 1) {
|
||||
this.$store.dispatch('shops:genericPurchase', {
|
||||
pinType: item.pinType,
|
||||
type: item.purchaseType,
|
||||
key: item.key,
|
||||
currency: item.currency,
|
||||
quantity,
|
||||
});
|
||||
async makeGenericPurchase (item, type = 'buyModal', quantity = 1) {
|
||||
try {
|
||||
await this.$store.dispatch('shops:genericPurchase', {
|
||||
pinType: item.pinType,
|
||||
type: item.purchaseType,
|
||||
key: item.key,
|
||||
currency: item.currency,
|
||||
quantity,
|
||||
});
|
||||
} catch (e) {
|
||||
if (!e.request) {
|
||||
// axios request errors already handled by app.vue
|
||||
this.$store.dispatch('snackbars:add', {
|
||||
title: '',
|
||||
text: e.message,
|
||||
type: 'error',
|
||||
});
|
||||
return;
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
this.$root.$emit('playSound', 'Reward');
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue