Nycheporuk
Nycheporuk
SSolidJS
Created by Nycheporuk on 4/18/2024 in #support
Is it possible to access Request in action?
const myAction = action(async (data: FormData) => {
"use server";
// can I access Request here?
// to extract request url, cookies and so on?
console.log(Object.fromEntries(data));
return "ok";
}, "save");

export default function SomeRoute() {
return (
<form method="post" action={myAction}>
<input name="example" />
<button type="submit">Submit</button>
</form>
);
}
const myAction = action(async (data: FormData) => {
"use server";
// can I access Request here?
// to extract request url, cookies and so on?
console.log(Object.fromEntries(data));
return "ok";
}, "save");

export default function SomeRoute() {
return (
<form method="post" action={myAction}>
<input name="example" />
<button type="submit">Submit</button>
</form>
);
}
6 replies