How promise returns a value instead of promise

function _getProductType (arr, num, str) {
  let type = ""
  arr.forEach(val => {
    if (num == val.code_val) { //eslint-disable-line
      type = val.code_desc
    } else if (num == "1000") { //eslint-disable-line
      type = ""
    }
  })
  return type + "" + (str || "")
}
export async function productType (num, str) {
  let productTypes = []
  function aaa () {
    return getByCode(52).then(res => {
      if (res.data.success) {
        productTypes = res.data.data
        return _getProductType(productTypes, num, str)
      }
    })
  }
  let b = await aaa()
  return b
}

productType is a filter for vue, but returns promise, but the label attribute in template accepts only string types.
how to deal with this situation (axios is also owned by promise.)

clipboard.png

Jan.02,2022

export async function productType (num, str) {
  const res = await getByCode(52);
  if (res.data.success) {
    let productTypes = res.data.data;
    return _getProductType(productTypes, num, str)
  }
  return 'ERROR' //?
}

written by guessing, your aaa function is completely redundant from the code. If you can't run it, change your own thinking

.

ide/filters.html" rel=" nofollow noreferrer "> filters can only be a Synchronize function.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b309e0-2bd0f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b309e0-2bd0f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?