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