check if new account data is non-empty

This commit is contained in:
2025-08-07 08:00:30 +02:00
parent 885ad40543
commit 61363cc400

View File

@@ -19,6 +19,11 @@ export async function POST({ request, locals }) {
const data = await request.json();
const userName = data.userName;
const userPassword = data.userPassword;
if (!userName || !userPassword) {
return json({ error: 'Missing input' }, { status: 400 });
}
const rowCount = addUser(userName, userPassword);
return new Response(null, { status: rowCount == 1 ? 200 : 400 });