fix(jobs): fetchJobs → loadJobs, add credentials to inline api helper

killJob() referenced fetchJobs() which is undefined — the correct name is
loadJobs(). Also the inline api() wrapper was missing credentials:'include'
so any API call on the jobs page would fail with a 401 in prod.
This commit is contained in:
Zac Gaetano 2026-05-18 23:48:56 -04:00
parent e472075087
commit 08e5ba6298

View file

@ -535,6 +535,7 @@ let activeCount = 0;
──────────────────────────────────────────────────────── */
async function api(path, opts = {}) {
const r = await fetch(API + path, {
credentials: 'include',
headers: { 'Content-Type': 'application/json' },
...opts
});
@ -700,7 +701,7 @@ async function killJob(jobId, ev) {
if (!confirm('Remove this job from the queue? If a worker is still processing it, the run is abandoned.')) return;
try {
const r = await fetch('/api/v1/jobs/' + encodeURIComponent(jobId), { method: 'DELETE', credentials: 'include' });
if (r.ok) { toast('Job removed', 'success'); fetchJobs(); }
if (r.ok) { toast('Job removed', 'success'); loadJobs(); }
else { const d = await r.json().catch(()=>({})); toast('Remove failed: ' + (d.error || r.statusText), 'error'); }
} catch (err) {
toast('Remove failed: ' + err.message, 'error');