Unable to return axios calls as data from JS Query

Attempting to utilize the axios library to make some calls out to an internal API of ours, and seemingly we are unable to return the response data to anything other than the console. The business end of the code (minus auth variables) looks as such:

var data = {}

axios
.post(`https://${domain}/oauth2/token`, requestBody, {
  headers: {
    "Content-Type": "application/x-www-form-urlencoded",
    "Authorization": "Basic " + `${btoa(encode)}`,
  },
})
.then((response) => {
  /*console.log(response.data.access_token)*/
  axios.get(`https://redacted.com/users/`, {
    headers: {
      "x-api-key": "REDACTED",
      "Authorization": `Bearer ${response.data.access_token}`
    }
  }).then((r) => {
    console.log(r)
    data = r
  }).catch((error) => {
    console.log(error)
  })
})
.catch((error) => {
  console.log(error)
});

return data

Where the console.log(r) is returning the desired data to the console, but a simple return r in that block returns nothing. I then attempted to set a variable outside the axios calls and set that after console logging r and nothing changes either.

@victoria for post office-hours followup

So it looks like the return data function is running before the axios.post call is finished. I wonder if putting await (docs on await here) before axios.post(... would work.

e.g.

``await axios
.post(https://${domain}/oauth2/token, requestBody, {
headers: {
"Content-Type": "application/x-www-form-urlencoded",
"Authorization": "Basic " + ${btoa(encode)},
},
})
.then((response) => {
/console.log(response.data.access_token)/
axios.get(https://redacted.com/users/, {
headers: {
"x-api-key": "REDACTED",
"Authorization": Bearer ${response.data.access_token}
}
}).then((r) => {
console.log(r)
data = r
}).catch((error) => {
console.log(error)
})
})
.catch((error) => {
console.log(error)
});

return data``

If you try it, do you get a different result?