I have a function in my vue/nuxt project to authorize a payment method, and inside de callback I need to execute a commit and a dispatch but the syntax apparently is not correct.
Any help will be appreciated.
myFunction () {
window.client.Payments.authorize({
payment_method_category: 'payments'
}, {
purchase_country: 'ES',
purchase_currency: 'EUR',
locale: 'es-ES',
billing_address: {
},
shipping_address: {
},
},
function (res) {
if (res.approved) {
** this.$store.commit('checkout/setMyFunctionAuthorizationToken', res.authorization_token)
this.$store.dispatch('checkout/finish')
** }
})
},
I can’t use the ‘this.$store’ but I don’t how to do it.