fix architecture and write new tests

This commit is contained in:
root
2026-06-10 00:40:19 -04:00
parent 560da1cadf
commit 80a597bc10
377 changed files with 84020 additions and 1337 deletions
@@ -33,13 +33,11 @@ export default function AdminUsersPage() {
const [form, setForm] = useState(EMPTY_FORM)
const [saving, setSaving] = useState(false)
function getToken() { return localStorage.getItem('admin_token') ?? '' }
async function fetchAdmins() {
try {
const res = await fetch(`${ADMIN_API_BASE}/admin/admins`, {
headers: { Authorization: `Bearer ${getToken()}` },
cache: 'no-store',
credentials: 'include',
})
const json = await res.json()
if (!res.ok) throw new Error(json?.message ?? 'Failed')
@@ -97,7 +95,8 @@ export default function AdminUsersPage() {
const res = await fetch(`${ADMIN_API_BASE}/admin/admins${editingAdminId ? `/${editingAdminId}` : ''}`, {
method: isEditing ? 'PATCH' : 'POST',
headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${getToken()}` },
headers: { 'Content-Type': 'application/json' },
credentials: 'include',
body: JSON.stringify(payload),
})
const json = await res.json()