Feat: delete and toggle node

This commit is contained in:
HFO4 2021-10-31 09:34:51 +08:00
parent f71a9ddd41
commit ee4eff7d7a

View File

@ -141,6 +141,21 @@ export default function Node() {
});
};
const deleteNode = (id) => {
setLoading(true);
API.delete("/admin/node/" + id)
.then(() => {
loadList();
ToggleSnackbar("top", "right", "节点已删除", "success");
})
.catch((error) => {
ToggleSnackbar("top", "right", error.message, "error");
})
.then(() => {
setLoading(false);
});
};
useEffect(() => {
loadList();
}, [page, pageSize]);
@ -286,6 +301,9 @@ export default function Node() {
</Tooltip>
<Tooltip title={"删除"}>
<IconButton
onClick={() =>
deleteNode(row.ID)
}
disabled={loading}
size={"small"}
>