18 lines
366 B
TypeScript
18 lines
366 B
TypeScript
'use server';
|
|
import { prisma, Prisma } from '@repo/db';
|
|
import bcrypt from 'bcryptjs';
|
|
|
|
export const register = async ({
|
|
password,
|
|
...user
|
|
}: Prisma.UserCreateInput) => {
|
|
const hashedPassword = await bcrypt.hash(password, 15);
|
|
const newUser = prisma.user.create({
|
|
data: {
|
|
...user,
|
|
password: hashedPassword,
|
|
},
|
|
});
|
|
return newUser;
|
|
};
|