import { json } from '@sveltejs/kit'; import { deleteUser } from '$lib/server/userService'; export async function DELETE({ params, locals }) { if (!locals.user) { return json({ error: 'Unauthorized' }, { status: 401 }); } const userId = params.user; const rowCount = deleteUser(userId); return new Response(null, { status: rowCount == 1 ? 204 : 400 }); }