database stuff

This commit is contained in:
2025-01-15 17:39:20 -05:00
parent e955a80d81
commit 4ca7c393ef
2 changed files with 7 additions and 4 deletions

View File

@@ -4,6 +4,8 @@ import { useState } from "react";
import { useRouter } from "next/navigation";
import { addUser, getUserByEmail } from "@actions/userActions";
import { users } from '@schemas/schema';
import bcrypt from 'bcryptjs';
export default function RegistrationForm() {
const router = useRouter();
const [error, setError] = useState("");
@@ -33,12 +35,13 @@ export default function RegistrationForm() {
}
try {
const hashedPassword = await bcrypt.hash(formData.password, 10);
addUser(
formData.first_name,
formData.last_name,
formData.username,
formData.email,
formData.password
hashedPassword
);
router.push("/signin"); // Redirect to login after successful registration
} catch (err) {