修改env
This commit is contained in:
@@ -76,15 +76,18 @@ export const useResources = (initialPagination, initialSorter, type) => {
|
||||
|
||||
const deleteResource = async (id) => {
|
||||
try {
|
||||
await resourceService.deleteResource(id, type);
|
||||
const data= await resourceService.deleteResource(id, type);
|
||||
if(data?.length>0){
|
||||
const newCurrent =
|
||||
resources.length === 1 && currentPagination.current > 1
|
||||
? currentPagination.current - 1
|
||||
: currentPagination.current;
|
||||
await fetchResources({ current: newCurrent });
|
||||
message.success("删除成功");
|
||||
}else{
|
||||
throw new Error("no level");
|
||||
}
|
||||
} catch (error) {
|
||||
message.error("删除失败");
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user