Would the sveltekit form action still work? #49
-
I'm getting While in // +page.server.ts
export const actions: Actions = {
default: async ({ url }) => {
console.log(url.searchParams.get('email')) // null
},
} // +page.svelte
<form method="POST">
<input type="text" name="email" />
<button type="submit">submit</button>
</form> |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
This has nothing to do with |
Beta Was this translation helpful? Give feedback.
This has nothing to do with
trpc-sveltekit
.Please consult the SvelteKit docs page: https://kit.svelte.dev/docs/form-actions
Just a couple of hints, though:
If you're using
POST
,email
can't be a search param; you'll probably have to extract it from request forma data.Also, form actions have nothing to do with
+page.ts
. They're handled in+page.server.ts
.