The problem of using axios.all in vue to request multiple api, backends to execute sequentially.

to request two api, sequentially, you must first delete the item, and then delete the group. Axios.all is called here, but sometimes this happens. The order in which the api is executed is fine, but it seems that sometimes the api of the group is deleted (the last one) at the backend, which causes the backend to check that it contains item, and therefore does not delete it.

clipboard.png

export const deleteInspect=(params1,params2)=>{
    return axios.all([
        axios.post(`${base}${itempath}/inspect/item/delete`,params1),
        axios.post(`${base}${itempath}/inspect/group/delete`,params2)
    ]);
}
deleteAllData(itemIdList,groupIdList){
    let params1={
        itemIds:itemIdList
    };
    let params2={
        groupIds:groupIdList
    };
    return new Promise((resolve,reject)=>{
        api.deleteInspect(params1,params2).then((res)=>{
            console.log(res);
            resolve(res);
        })
    })
}
Mar.23,2022

if you need serial, do not use parallel method. You can successfully compare and see luck. The backend accepts 2 interface processing, depending on the interface processing speed, 2 parallel processing. If the processing of deleting group is fast, then delete group


will be executed first.

export async deleteInspect = (params1,params2) {

   let  deleteItem = await axios.post(`${base}${itempath}/inspect/item/delete`,params1);
   let  deleteGroup = await  axios.post(`${base}${itempath}/inspect/item/delete`,params2);

}

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