Updated login page, added ProtectedRoute object for wrapping in layouts, added ProtectedRoute authorization verification to Admin route root

This commit is contained in:
Hannah dagemark 2026-09-14 23:12:12 +02:00
commit efa42a53b2
5 changed files with 65 additions and 17 deletions

View file

@ -1,25 +0,0 @@
"use client";
import { useState } from "react";
import { login, signup } from "@/lib/server_functions/userAuth";
export default function Login() {
const [createAccount, setCreateAccount] = useState(false);
return (
<div>
<form action={createAccount ? login : signup}>
<input type="text" name="username" placeholder="Username" required />
<input
type="password"
name="password"
placeholder="Password"
required
/>
<button type="submit">{createAccount ? "Login" : "Signup"}</button>
</form>
<button onClick={() => setCreateAccount(!createAccount)}>
{createAccount ? "Don't have an account?" : "Already have an account?"}
</button>
</div>
);
}