Limpieza post-diagnóstico del 403 (checkOrigin resuelto)

- Elimina /api/whoami (endpoint diagnóstico temporal).
- Elimina bloque debug del 403 en /api/admin/prestamos/[id]/devolver.
- Bitácora con la causa raíz y el fix.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-08-16 14:22:10 -07:00
parent 311f14b0eb
commit 927d99c262
3 changed files with 8 additions and 17 deletions
@@ -5,12 +5,7 @@ const json = (body: unknown, status = 200) =>
export const POST: APIRoute = async ({ params, locals }) => {
if (!locals.user) return json({ error: 'no autenticado' }, 401);
if (locals.profile?.rol !== 'admin') {
return json({
error: 'no autorizado',
debug: { email: locals.user.email, profile_rol: locals.profile?.rol ?? null },
}, 403);
}
if (locals.profile?.rol !== 'admin') return json({ error: 'no autorizado' }, 403);
const id = Number(params.id);
if (!Number.isInteger(id) || id <= 0) return json({ error: 'id inválido' }, 400);