feat(auth): add signup page with form action
Composes BrandPanel + SignupForm in responsive split layout. Server action POSTs to /v1/auth/signup and redirects to /household/setup on success. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
23
frontend/src/routes/(public)/signup/+page.server.ts
Normal file
23
frontend/src/routes/(public)/signup/+page.server.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { redirect, fail } from '@sveltejs/kit';
|
||||
import { apiClient } from '$lib/server/api';
|
||||
import type { Actions } from './$types';
|
||||
|
||||
export const actions = {
|
||||
default: async ({ request, fetch }) => {
|
||||
const formData = await request.formData();
|
||||
const displayName = formData.get('displayName') as string;
|
||||
const email = formData.get('email') as string;
|
||||
const password = formData.get('password') as string;
|
||||
|
||||
const api = apiClient(fetch);
|
||||
const { data, error } = await api.POST('/v1/auth/signup', {
|
||||
body: { displayName, email, password }
|
||||
});
|
||||
|
||||
if (error) {
|
||||
return fail(400, { error: 'Registrierung fehlgeschlagen. Bitte versuche es erneut.' });
|
||||
}
|
||||
|
||||
redirect(303, '/household/setup');
|
||||
}
|
||||
} satisfies Actions;
|
||||
Reference in New Issue
Block a user