Lifecycle: change data with post request response

Thank you so much @sunnyson. Yes, that’s exactly what I’ve tried. I’m always getting back the following error:

 error TypeError: Cannot read property 'data' of undefined

So I was wondering if my approach is wrong. Any ideas what could’ve happened?

  let externalData = await axios.post('URL', shopifyProduct, axiosConfig)
  .then((res) => {
console.log("RESPONSE RECEIVED: ", res.status);
console.log("RESPONSE ", res);
  })
  .catch((err) => {
console.log("AXIOS ERROR: ", err);
  })

  data.shopifyID = externalData.data.product.id

POST request works, and I get back the needed response.
Thank you for your help!

//EDIT
Oh nevermind, I just realized my mistake. The data.shopifyID = externalData.data.product.id goes into the Promise and not outside. Thank you so much for your help!