后台管理
diff --git a/web/src/app/page.tsx b/web/src/app/page.tsx index 8b8940d..9213e93 100644 --- a/web/src/app/page.tsx +++ b/web/src/app/page.tsx @@ -1,7 +1,7 @@ "use client"; import Link from "next/link"; -import { FormEvent, useMemo, useState } from "react"; +import { FormEvent, useEffect, useState } from "react"; import { useAuth } from "@/components/auth-provider"; import { API_BASE_URL, readApiError } from "@/lib/api"; @@ -9,6 +9,13 @@ import { API_BASE_URL, readApiError } from "@/lib/api"; type Mode = "login" | "register"; type PingResponse = { message: string }; +type RememberedCredentials = { + email: string; + password: string; +}; + +const REMEMBER_CREDENTIALS_KEY = "fquiz.remembered_credentials"; + export default function Home() { const { user, initializing, login, register, logout, hasPermission } = useAuth(); @@ -16,14 +23,29 @@ export default function Home() { const [email, setEmail] = useState(""); const [username, setUsername] = useState(""); const [password, setPassword] = useState(""); + const [rememberPassword, setRememberPassword] = useState(false); const [busy, setBusy] = useState(false); const [error, setError] = useState(""); const [pingResult, setPingResult] = useState