react
我在实现这么一个批量删除功能
但是批量删除中会有某些内容需要弹出二次确认弹框
我希望能够通过 promise 实现链式的操作
const delete = (ids: string[]) => {
ids.forEach(async(id)=>{
await deleteOne(id)
})
}
const deleteOne = async(id) => {
/** dosomething **/
if(await confirm(id)){
/** do delete **/
}
}
const confirm = async(id){
/** 这里我要怎么实现 **/
}
注意:这里的 confirm 需要弹出二次确认弹框并返回 promise ,或者有什么其他更好的办法?