diff --git a/src/routes/admin/+page.svelte b/src/routes/admin/+page.svelte index 246c5fa..c694f1a 100644 --- a/src/routes/admin/+page.svelte +++ b/src/routes/admin/+page.svelte @@ -115,7 +115,7 @@ dragGroupId = null; dragOverGroupId = null; // Persist - fetch('${api}/order', { + fetch(`${api}/order`, { method: 'PUT', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ groups: groups.map((g) => g.id) }) @@ -169,7 +169,7 @@ // Build ordered IDs for this group const groupKey = groupId ?? 'null'; const groupUnitIds = units.filter((u) => (u.group ?? null) === groupId).map((u) => u.id); - fetch('${api}/order', { + fetch(`${api}/order`, { method: 'PUT', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ units: { [groupKey]: groupUnitIds } }) @@ -185,8 +185,8 @@ // ── Load data ──────────────────────────────────────────────────────────────── async function loadData() { const [res, gres] = await Promise.all([ - fetch('${api}/units'), - fetch('${api}/groups') + fetch(`${api}/units`), + fetch(`${api}/groups`) ]); if (!res.ok) return; const units: Unit[] = await res.json(); @@ -291,7 +291,7 @@ } try { const res = unitFormNew - ? await fetch('${api}/units', { + ? await fetch(`${api}/units`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(unitForm) @@ -322,7 +322,7 @@ } try { const res = groupFormNew - ? await fetch('${api}/groups', { + ? await fetch(`${api}/groups`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(groupForm) @@ -459,7 +459,7 @@ } try { const res = unitFormNew - ? await fetch('${api}/units', { + ? await fetch(`${api}/units`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(unitForm) @@ -509,7 +509,7 @@ } try { const res = groupFormNew - ? await fetch('${api}/groups', { + ? await fetch(`${api}/groups`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(groupForm) @@ -666,6 +666,7 @@