I am trying to await the axios response in takePaymentCallback() but its always returning undefined, how can I call that function correctly?
async takePaymentCallback(content, successCallback) {
const response = await this.takeCardPayment(JSON.parse(content));
console.log('res:', response);
}
async takeCardPayment(formData) {
this.$axios
.post(`/api/enterprise/Payment/TakeCardPayment`, formData)
.then(res => {
if (!res.ok) {
console.error(
'POST Take Card Payment - ' + res.problem,
res.data
);
return res;
}
return res;
});
},