feat: implement user signup functionality with session management
This commit is contained in:
22
src/routes/signup/+page.server.ts
Normal file
22
src/routes/signup/+page.server.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { db } from '$lib/server/db';
|
||||
import { userTable } from '$lib/server/db/schema';
|
||||
import type { Actions } from './$types';
|
||||
|
||||
export const actions = {
|
||||
default: async ({ request }) => {
|
||||
const formData = await request.formData();
|
||||
const name = formData.get('name');
|
||||
const email = formData.get('email');
|
||||
const password = formData.get('password');
|
||||
|
||||
// TODO: Implement data validation.
|
||||
|
||||
const userRecord = await db.insert(userTable).values({
|
||||
name: name as string,
|
||||
email: email as string,
|
||||
password: password as string
|
||||
}).returning();
|
||||
|
||||
// TODO: Handle post-signup logic (e.g., redirect, session creation).
|
||||
}
|
||||
} satisfies Actions;
|
||||
Reference in New Issue
Block a user