需要順序請求兩個api,必須先刪除item,后刪除group。這里用axios.all 調用,但是有時候會出現這中情況,看執行api的順序沒問題,但好像有時候在后端先執行的刪除group的api(后一個),導致后端進行檢查顯示含有item,從而沒刪掉。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);
})
})
}
1 回答

江戶川亂折騰
TA貢獻1851條經驗 獲得超5個贊
你這樣需要的串行,不要使用并行的方式,能夠成功比較看運氣,后端接受到2個接口處理,看接口處理速度,2個并行的處理,如果刪除group的處理的快,那么就會先執行刪除group
添加回答
舉報
0/150
提交
取消