Can new Promise get the callback of Promise?

export function fetch(url,params={}) {
    return new Promise((resolve , reject) => {
      axios.get(url,{
        params:params
      }).then(response=>{
        resolve(response.data)
      }).catch(err=>{
        reject(err)
      })
    })
}
      

I think everyone else is encapsulated in this way, so can you get the callback after the request by calling the fetch method?

Mar.19,2021

still want .then , axios is to return Promise , if you just want to return data directly, that's fine. (still troublesome)

export function fetch(url,params={}) {
    return axios.get(url,{
        params:params
      })
    .then((response) => Promise.resolve(response.data))
}

chain call, followed by the previous return;
axios has a public configuration. You don't have to write

each.
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-1b38adf-2b8ae.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-1b38adf-2b8ae.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?