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
@@ -70,13 +70,11 @@ export default function AdminRentersPage() {
const [error, setError] = useState<string | null>(null)
const [actioning, setActioning] = useState<string | null>(null)
function getToken() { return localStorage.getItem('admin_token') ?? '' }
async function fetchRenters() {
try {
const res = await fetch(`${ADMIN_API_BASE}/admin/renters`, {
headers: { Authorization: `Bearer ${getToken()}` },
cache: 'no-store',
credentials: 'include',
})
const json = await res.json()
if (!res.ok) throw new Error(json?.message ?? 'Failed')
@@ -105,7 +103,7 @@ export default function AdminRentersPage() {
const endpoint = isBlocked ? 'unblock' : 'block'
const res = await fetch(`${ADMIN_API_BASE}/admin/renters/${id}/${endpoint}`, {
method: 'POST',
headers: { Authorization: `Bearer ${getToken()}` },
credentials: 'include',
})
if (!res.ok) throw new Error('Action failed')
await fetchRenters()