aboutsummaryrefslogtreecommitdiff
path: root/client/src
diff options
context:
space:
mode:
authorMateja <mail@matejamaric.com>2021-07-28 18:14:09 +0200
committerMateja <mail@matejamaric.com>2021-07-28 18:14:09 +0200
commit9f4a1c17d4f544784dc5e11ecf6d04c8b5d0582a (patch)
tree20b5581c27ec3d1630afd037aa8c7669985462a1 /client/src
parent150ee5308798bad3384b4b565c8fbc77b5cd3973 (diff)
downloadmevn-ecommerce-9f4a1c17d4f544784dc5e11ecf6d04c8b5d0582a.tar.gz
mevn-ecommerce-9f4a1c17d4f544784dc5e11ecf6d04c8b5d0582a.zip
Use arrow functions when setting up PayPal buttons.
Diffstat (limited to 'client/src')
-rw-r--r--client/src/views/Checkout.vue38
1 files changed, 19 insertions, 19 deletions
diff --git a/client/src/views/Checkout.vue b/client/src/views/Checkout.vue
index fc8bdd0..52da138 100644
--- a/client/src/views/Checkout.vue
+++ b/client/src/views/Checkout.vue
@@ -62,32 +62,32 @@ export default {
this.$store.commit('removeFromCart', id);
},
paypalLoaded() {
- const dispatch = this.$store.dispatch;
- const commit = this.$store.commit;
- const thisVue = this;
-
window.paypal.Buttons({
- async createOrder() {
- return await dispatch('createOrder');
+ createOrder: async () => {
+ return await this.$store.dispatch('createOrder');
},
- async onApprove(data) {
- const success = await dispatch('captureOrder', data.orderID);
+
+ onApprove: async (data) => {
+ const success = await this.$store.dispatch('captureOrder', data.orderID);
+
if (success === true) {
- thisVue.modalTitle = 'Success!';
- thisVue.modalText = 'Your purchase should arrive within 7 days!';
- thisVue.showModal = true;
- commit('clearCart');
+ this.modalTitle = 'Success!';
+ this.modalText = 'Your purchase should arrive within 7 days!';
+ this.$store.commit('clearCart');
}
else {
- thisVue.modalTitle = 'Failure!';
- thisVue.modalText = 'Your order was not successfully paid! Check your funds or try again later.';
- thisVue.showModal = true;
+ this.modalTitle = 'Failure!';
+ this.modalText = 'Your order was not successfully paid! Check your funds or try again later.';
}
+
+ this.showModal = true;
},
- onError(err) {
- thisVue.modalTitle = 'Error!';
- thisVue.modalText = 'Error occurred! Please try again later.';
- thisVue.showModal = true;
+
+ onError: (err) => {
+ this.modalTitle = 'Error!';
+ this.modalText = 'Error occurred! Please try again later.';
+ this.showModal = true;
+
console.error(err);
}
}).render(this.$refs.paypal);