#How to get the form body in a .astro file?

5 messages · Page 1 of 1 (latest)

harsh marsh
#
if (Astro.request.method === "POST") {
    // TODO GET THE FORM DATA HERE
}
---
    <h1>Login to Site</h1>
    <form method="post" class="login">
        <label for="email">Email:</label>
        <input type='email' id="email"/>
        <button class="submit">Login</button>
    </form>
#

How to get the form body in a .astro file?

cursive oak
#
if (Astro.request.method === "POST") {
    const data = await Astro.request.formData();
}
---
    <h1>Login to Site</h1>
    <form method="post" class="login">
        <label for="email">Email:</label>
        <input type='email' id="email"/>
        <button class="submit">Login</button>
    </form>
harsh marsh
cursive oak