mirror of
https://github.com/samuelncui/yatm.git
synced 2026-01-05 04:55:23 +00:00
feat: add confirm for delete task
This commit is contained in:
@@ -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]);
|
||||
|
||||
Reference in New Issue
Block a user