The result cannot be return in .then of the es6 function

export function postMethod(data) {
  const baseURL = process.env.BASE_API
  axios({
    method: "post",
    url: baseURL + "/img_upload",
    timeout: 50000,
    data: data,
    headers: {
      "loginToken": getLoginToken()
    }
  }).then(res => {
    const respose = res.data
    if (respose.errno == "success") {  //
      //console.log(respose.data)
      //******************((((((((((((((((
      return respose.data
      //******************))))))))))))))))
    } else if (respose.errno == "fail") {  //
      Message({
        message: respose.msg,
        type: "error",
        duration: 2 * 1000
      })
    } else { //
      Message({
        message: "",
        type: "error",
        duration: 2 * 1000
      })
    }
  })
}

when postMethod (data) is used elsewhere, the result is undefined.
this return doesn"t work, so how do I get the function to return the data returned when calling the interface?


export async function postMethod (data) {
    ...
    return await axios({
        ...
    }) 
}
async funcion getRes (...) { // 
    let res = await postMethod(...)
    ..... // res
}
// 
getRes(...)
Menu