From 81c06ad13bf5dddba6911927107ba5a1726722a6 Mon Sep 17 00:00:00 2001 From: zwitschi Date: Wed, 29 Apr 2026 17:23:34 +0200 Subject: [PATCH] feat: update video jobs API calls to use backend URL and authorization headers Co-authored-by: Copilot --- frontend/app/templates/admin/videos.html | 33 +++++++++++++++++++----- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/frontend/app/templates/admin/videos.html b/frontend/app/templates/admin/videos.html index 2c9f51c..d6d4320 100644 --- a/frontend/app/templates/admin/videos.html +++ b/frontend/app/templates/admin/videos.html @@ -78,7 +78,14 @@ block content %} async function fetchJobs() { try { - const response = await fetch("/api/v1/admin/videos"); + const response = await fetch( + "{{ config['BACKEND_URL'] }}/admin/videos", + { + headers: { + Authorization: "Bearer {{ session['access_token'] }}", + }, + }, + ); if (!response.ok) throw new Error("Failed to fetch jobs"); const jobs = await response.json(); jobsTableBody.innerHTML = ""; @@ -123,9 +130,15 @@ block content %} purgeStatus.classList.remove("text-red-500", "text-green-500"); try { - const response = await fetch("/api/v1/admin/videos/purge", { - method: "POST", - }); + const response = await fetch( + "{{ config['BACKEND_URL'] }}/admin/videos/purge", + { + method: "POST", + headers: { + Authorization: "Bearer {{ session['access_token'] }}", + }, + }, + ); const data = await response.json(); if (!response.ok) throw new Error(data.detail || "Failed to purge jobs"); @@ -145,9 +158,15 @@ block content %} if (e.target.classList.contains("cancel-btn")) { const jobId = e.target.dataset.jobId; try { - const response = await fetch(`/api/v1/admin/videos/${jobId}/cancel`, { - method: "POST", - }); + const response = await fetch( + `{{ config['BACKEND_URL'] }}/admin/videos/${jobId}/cancel`, + { + method: "POST", + headers: { + Authorization: "Bearer {{ session['access_token'] }}", + }, + }, + ); if (!response.ok) throw new Error("Failed to cancel job"); fetchJobs(); } catch (error) {