-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Closed
Description
Description
I cannot get "data" to get passed along to the server when using sveltekit. I am trying this:
I set the "useChat" up on my +page.svelte
const { input, handleSubmit, messages } = useChat();
My submit handler:
function submitHandler(event: any) {
event.preventDefault();
handleSubmit(event, {
data: {
test: 'data'
}
});
}
And my server:
export const POST = (async ({ request }) => {
try {
const jsonData = await request.json();
console.dir(jsonData); // "data" object is missing from here. i only have "messages"
Based on this React example I also tried:
<form
on:submit={(e) => {
handleSubmit(e, {
data: {
test: 'data'
}
});
}}
>
but "data" is still not available in +server.ts endpoint
Code example
No response
Additional context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels