diff options
| author | nsfisis <nsfisis@gmail.com> | 2024-07-27 01:17:37 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2024-07-27 05:59:23 +0900 |
| commit | 18308a22879dc9143a03bcbe53cf0c5e8e49ee1f (patch) | |
| tree | c1c108e27b1c369f30670480e19082044ae1b8a0 /frontend/src/routes/Login.tsx | |
| parent | e487036c5cc9f5b59e9efbaec132a2fd60896317 (diff) | |
| download | phperkaigi-2025-albatross-18308a22879dc9143a03bcbe53cf0c5e8e49ee1f.tar.gz phperkaigi-2025-albatross-18308a22879dc9143a03bcbe53cf0c5e8e49ee1f.tar.zst phperkaigi-2025-albatross-18308a22879dc9143a03bcbe53cf0c5e8e49ee1f.zip | |
remix
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}/`); -} |
