Commit bc18f6d5 by HoMeTown

feat: 收藏列表的删除

parent 4ceeae5c
......@@ -55,10 +55,21 @@ export const Collect: React.FC = () => {
}
const handleSureDel = async () => {
const idx = collectList.findIndex((item: any) => item.collectionId === curCollectId)
const res = await fetchDelCollection([curCollectId])
setIsOpen(false)
if (res.ok) {
setIsOpen(false)
getCollectList()
if (collectList.length < pageSize) {
const resList = await fetchQueryCollectionList({ pageNum: 1, pageSize })
setCollectList(resList.data.records)
setTotal(resList.data.total)
}
else {
const _collectList = JSON.parse(JSON.stringify(collectList))
_collectList.splice(idx, 1)
setCollectList(_collectList)
setTotal(total - 1)
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment