Added register
This commit is contained in:
17
apps/hub/app/(auth)/register/action.ts
Normal file
17
apps/hub/app/(auth)/register/action.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
'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;
|
||||
};
|
||||
Reference in New Issue
Block a user