Update client code
This commit is contained in:
parent
3cd3ce7c8e
commit
a686d84968
|
|
@ -129,7 +129,6 @@ export default defineComponent({
|
|||
return `${field} ist ein Pflichtfeld`;
|
||||
},
|
||||
validateBeforeSubmit({ coupon: couponCode }) {
|
||||
console.log('coupon', couponCode);
|
||||
this.submitted = true;
|
||||
this.loading = true;
|
||||
this.$apollo
|
||||
|
|
@ -141,7 +140,7 @@ export default defineComponent({
|
|||
},
|
||||
},
|
||||
update: (store, { data: { coupon } }) => {
|
||||
if (coupon.success) {
|
||||
if (coupon.result.__typename == 'Success') {
|
||||
this.couponErrors = [];
|
||||
this.$apollo
|
||||
.query({
|
||||
|
|
@ -149,17 +148,16 @@ export default defineComponent({
|
|||
fetchPolicy: 'network-only',
|
||||
})
|
||||
.then(() => this.$router.push('/'));
|
||||
} else {
|
||||
this.couponErrors = ['Der angegebene Coupon-Code ist ungültig.'];
|
||||
}
|
||||
},
|
||||
})
|
||||
.catch(({ message }) => {
|
||||
if (message.indexOf('invalid_coupon') > -1) {
|
||||
this.couponErrors = ['Der angegebene Coupon-Code ist ungültig.'];
|
||||
} else {
|
||||
this.couponErrors = [
|
||||
'Es ist ein Fehler aufgetreten. Bitte versuchen Sie es nochmals oder kontaktieren Sie den Administrator.',
|
||||
];
|
||||
}
|
||||
console.error(message);
|
||||
})
|
||||
.finally(() => {
|
||||
this.loading = false;
|
||||
|
|
|
|||
Loading…
Reference in New Issue