diff options
Diffstat (limited to 'frontend/src/routes/Login.tsx')
| -rw-r--r-- | frontend/src/routes/Login.tsx | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/frontend/src/routes/Login.tsx b/frontend/src/routes/Login.tsx deleted file mode 100644 index 4871060..0000000 --- a/frontend/src/routes/Login.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import { redirect, Form, ActionFunctionArgs } from "react-router-dom"; - -export default function Login() { - return ( - <div> - <h1>Albatross.swift</h1> - <h2>Login</h2> - <Form method="post"> - <label>Username</label> - <input type="text" name="username" /> - <label>Password</label> - <input type="password" name="password" /> - <button type="submit">Login</button> - </Form> - </div> - ); -} - -export async function loginAction({ request }: ActionFunctionArgs) { - const formData = await request.formData(); - const username = formData.get("username"); - const password = formData.get("password"); - - const res = await fetch("/api/login", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ username, password }), - }); - if (!res.ok) { - throw res; - } - const { userId } = await res.json(); - return redirect(`/users/${userId}/`); -} |
