check if new account data is non-empty
This commit is contained in:
@@ -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 });
|
||||
|
||||
Reference in New Issue
Block a user