add: 持久化所有任务记录

This commit is contained in:
2026-06-20 12:20:39 +08:00
parent cd051900b5
commit ba9d0977e3
11 changed files with 465 additions and 189 deletions
+33
View File
@@ -44,6 +44,39 @@ export async function deleteRecurringJob(id) {
});
}
export async function listOneTimeJobs() {
const res = await request("/api/one-time-jobs");
return (res && res.jobs) || [];
}
export async function createOneTimeJob(job) {
const res = await request("/api/one-time-jobs", {
method: "POST",
body: job,
});
return res && res.job;
}
export async function runOneTimeJobNow(id) {
const res = await request(`/api/one-time-jobs/${encodeURIComponent(id)}/run`, {
method: "POST",
});
return res && res.job;
}
export async function stopOneTimeJob(id) {
const res = await request(`/api/one-time-jobs/${encodeURIComponent(id)}/stop`, {
method: "POST",
});
return res && res.job;
}
export async function deleteOneTimeJob(id) {
return request(`/api/one-time-jobs/${encodeURIComponent(id)}`, {
method: "DELETE",
});
}
async function request(path, { method = "GET", body } = {}) {
const headers = { "Content-Type": "application/json" };
const res = await fetch(`${API_BASE}${path}`, {