feat: add confirm for delete task

This commit is contained in:
Samuel N Cui
2023-10-13 14:15:34 +08:00
parent b0505b4955
commit 455099287d

View File

@@ -17,6 +17,10 @@ import { RefreshContext } from "../pages/jobs";
const DeleteJobButton = ({ jobID }: { jobID: bigint }) => {
const refresh = useContext(RefreshContext);
const deleteJob = useCallback(async () => {
if (!confirm(`Delete job ${jobID}, this may cause data loss.`)) {
return;
}
await cli.jobDelete(JobDeleteRequest.create({ ids: [jobID] }));
await refresh();
}, [jobID]);