SolidJSS
SolidJSโ€ข2y agoโ€ข
5 replies
Nycheporuk

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>
    );
}
Was this page helpful?