I have an api request on the backend that looks like this:
import Acuity from 'acuityscheduling';
let acuity = Acuity.basic({
userId: xxx,
apiKey: 'xxx'
});
export function reschedule(id, datetime){
var options = {
method: 'PUT',
body: {
datetime : datetime
}
}
acuity.request('appointments/' + id + '/reschedule', options, function (err, res, appointments) {
if (err) return err;
return appointments;
})
}
I want to return err or appointments to the front end but keep getting undefined.
I’ve tried
return acuity.request...
but that only returns the actual request itself to the front end and not the response which is what I need
My front end code looks like:
import {reschedule} from 'backend/aModule'
reschedule(data._id, datetime).then((msg) => {
console.log(msg) //returns undefined
})
Can anyone help me out with this?