diff --git a/apps/web/src/app/login/page.tsx b/apps/web/src/app/login/page.tsx index 2023d24..fd007e3 100644 --- a/apps/web/src/app/login/page.tsx +++ b/apps/web/src/app/login/page.tsx @@ -4,14 +4,14 @@ import { useState, type FormEvent } from "react"; import Link from "next/link"; import { Button, Card, Input } from "../../components/ui/primitives"; import { api, errorMessage } from "../../lib/api-client"; -import { useAuth } from "../../lib/auth-store"; +import { setSessionToken } from "../../lib/session-token"; +import type { AuthResult } from "../../lib/api-types"; /** * /login — bare sign-in: username and password, nothing else. Account creation * lives at /signup; collective joining happens with an invite link. */ export default function LoginPage(): React.ReactElement { - const { login } = useAuth(); const [username, setUsername] = useState(""); const [password, setPassword] = useState(""); const [busy, setBusy] = useState(false); @@ -22,7 +22,12 @@ export default function LoginPage(): React.ReactElement { setBusy(true); setError(null); try { - await api.post("/auth/login", { username: username.trim(), password }, { redirectOn401: false }); + const result = await api.post( + "/auth/login", + { username: username.trim(), password }, + { redirectOn401: false }, + ); + setSessionToken(result.token); window.location.assign("/streams"); } catch (err) { setError(errorMessage(err));