Skip to content

Commit f513618

Browse files
committed
♻️ Use helper method (#2446)
1 parent 38f825e commit f513618

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/routes/(auth)/signup/+page.server.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
// See:
22
// https://lucia-auth.com/guidebook/sign-in-with-username-and-password/sveltekit/
33
// https://superforms.rocks/get-started
4-
import { superValidate } from 'sveltekit-superforms/server';
5-
import { zod } from 'sveltekit-superforms/adapters';
64
import { fail, redirect } from '@sveltejs/kit';
75
import { PrismaClientKnownRequestError } from '@prisma/client/runtime/library';
86
import { LuciaError } from 'lucia';
97

10-
import { initializeAuthForm } from '$lib/utils/authorship';
11-
import { authSchema } from '$lib/zod/schema';
8+
import { initializeAuthForm, validateAuthFormWithFallback } from '$lib/utils/authorship';
129
import { auth } from '$lib/server/auth';
1310

1411
import {
@@ -27,7 +24,7 @@ export const load: PageServerLoad = async ({ locals }) => {
2724
// FIXME: エラー処理に共通部分があるため、リファクタリングをしましょう。
2825
export const actions: Actions = {
2926
default: async ({ request, locals }) => {
30-
const form = await superValidate(request, zod(authSchema));
27+
const form = await validateAuthFormWithFallback(request);
3128

3229
if (!form.valid) {
3330
return fail(BAD_REQUEST, {

0 commit comments

Comments
 (0)