feat: update video jobs API calls to use backend URL and authorization headers

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
2026-04-29 17:23:34 +02:00
parent d1c2b6da68
commit 81c06ad13b
+26 -7
View File
@@ -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) {