diff --git a/package.json b/package.json index 6d69b37..5c589b1 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "repair:ci": "node scripts/code-repair-agent.mjs --ci", "build:fix": "npm run build 2>&1 || node scripts/code-repair-agent.mjs --ci", "build": "next build", - "start": "next start -p 3006", + "start": "node scripts/ensure-ollama.mjs && concurrently -n AI,NEXT -c cyan,green \"npm run dev:rust\" \"next start -p 3006\"", "lint": "eslint" }, "dependencies": { diff --git a/src/app/client-portal/login/page.tsx b/src/app/client-portal/login/page.tsx index 7a70fdb..3191261 100644 --- a/src/app/client-portal/login/page.tsx +++ b/src/app/client-portal/login/page.tsx @@ -14,16 +14,26 @@ export default function ClientLoginPage() { const [checking, setChecking] = useState(true) const [debugInfo, setDebugInfo] = useState("") + const [sessionUser, setSessionUser] = useState<{ email: string; role: string } | null>(null) + useEffect(() => { fetch("/api/auth/me", { credentials: "include" }) .then((r) => r.json()) .then((data) => { if (data.user?.role === "client") router.push("/client-portal/dashboard") - else setChecking(false) + else { + if (data.user) setSessionUser({ email: data.user.email, role: data.user.role }) + setChecking(false) + } }) .catch(() => setChecking(false)) }, [router]) + const handleSignOut = async () => { + await fetch("/api/auth/logout", { method: "POST" }) + setSessionUser(null) + } + const handleSubmit = async (e: React.FormEvent) => { e.preventDefault() setLoading(true) @@ -83,6 +93,18 @@ export default function ClientLoginPage() {
Sign in to view your projects and invoices
+ {sessionUser && ( +