Add check to login

This commit is contained in:
orosmatthew 2023-04-27 22:31:05 -04:00
parent a7c73e106b
commit 99c0b6fd6b

View File

@ -6,6 +6,9 @@ export const actions = {
const data = await request.formData(); const data = await request.formData();
const username = data.get('username')?.toString(); const username = data.get('username')?.toString();
const password = data.get('password')?.toString(); const password = data.get('password')?.toString();
if (!username || !password) {
return { success: false };
}
const user = await db.user.findUnique({ where: { username: username } }); const user = await db.user.findUnique({ where: { username: username } });
if (!user) { if (!user) {
return { success: false }; return { success: false };