So I am 99% sure this cannot be done, but humor me for a moment. Consider the two functions:
function doAjaxCall(fieldTocheckAgainst, currentField, value) {
  axios.get(
    window.location.origin +
    '/api/clinic/'+window.id+'/patient/'+window.secondId+'/field-validation',
    {
      params: {
        field_to_check_against: fieldTocheckAgainst,
        current_field: currentField,
        value: moment(value).format('YYYY-MM-DD')
      }
    }
  ).then((result) => {
    return result.data
  });
}
async function resolveAjaxCall(fieldTocheckAgainst, currentField, value) {
  const result = await doAjaxCall(fieldTocheckAgainst, currentField, value)
  console.log(result);
}
I am attempting to resolve the axios ajax call into a variable based on what I saw here and it doesn't work. I get undefined.
I understand when it comes to callbacks, everything has to be done in the callback, but is there no way, with async and await to resolve the promise to a variable as I am attempting to do, to then use said variable else where?
Or am I just going to be stuck with callbacks?
 
     
    