Access JSON response.status outside the function (Axios)

Im using Facebook API, trying to create a custom

async function createAudience(data) {
  try {
    console.log(` Upload: ${JSON.stringify(data)}`);
    return await`{account_id}/audience`, data);
  } catch (error) {

And it works just fine, but I need to access the response.status outside the function, and im lost…

      const ca_response = await createAudience(audienceData)
  .then((result) => {
    return result.status })
  .catch(err => console.error(err));

I can push it and it works, I can acces ((result) => { return result.status }) from the function without an issue, but can’t work with it from ouside… How can i create the const audienceStatus to be used on the rest of my code?? Thanks!

204 thoughts on “Access JSON response.status outside the function (Axios)”