Fixed AI Auto Launch, Fixed Client Login not working
Build & Auto-Repair / build (push) Has been cancelled

This commit is contained in:
JCBSComputer
2026-07-01 16:36:48 +02:00
parent 7606af04ab
commit 4a33ca0368
4 changed files with 43 additions and 8 deletions
+17 -4
View File
@@ -42,9 +42,17 @@ function LoginForm() {
useEffect(() => {
fetch("/api/auth/me", { credentials: "include" })
.then((r) => {
if (r.ok) router.push("/dashboard")
else setCheckingSession(false)
.then(async (r) => {
if (r.ok) {
const data = await r.json().catch(() => ({}))
if (data.user?.role === "client") {
window.location.href = "/client-portal/dashboard"
} else {
router.push("/dashboard")
}
} else {
setCheckingSession(false)
}
})
.catch(() => setCheckingSession(false))
}, [router])
@@ -239,11 +247,16 @@ function LoginForm() {
})
if (res.ok) {
const loginData = await res.json().catch(() => ({}))
localStorage.removeItem(WEBSITE_THEME_KEY)
const root = document.documentElement
root.className = root.className.split(" ").filter((c) => !c.startsWith("theme-")).join(" ").trim()
const redirectTo = searchParams.get("redirect") || "/dashboard"
router.push(redirectTo)
if (loginData.user?.role === "client") {
window.location.href = "/client-portal/dashboard"
} else {
router.push(redirectTo)
}
} else {
const data = await res.json().catch(() => ({}))
setError(data.error || "Invalid email or password.")