From 4212c1f6324cf83152274afd158fcbf8630c3926 Mon Sep 17 00:00:00 2001 From: Mannu Date: Sun, 17 May 2026 11:20:53 +0530 Subject: [PATCH] Debug login flow --- src/app/admin-login/page.tsx | 3 +++ src/app/admin/layout.tsx | 1 + 2 files changed, 4 insertions(+) diff --git a/src/app/admin-login/page.tsx b/src/app/admin-login/page.tsx index cc9b357..ab4e6c6 100644 --- a/src/app/admin-login/page.tsx +++ b/src/app/admin-login/page.tsx @@ -34,6 +34,9 @@ export default function AdminLoginPage() { const data = await res.json(); if (res.ok && data.success) { + console.log("LoginPage: success, checking cookie before redirect..."); + const token = document.cookie.match(/tia_admin_session=([^;]+)/)?.[1]; + console.log("LoginPage: cookie token =", token ? "found" : "NOT FOUND"); router.push("/admin"); } else { setError(data.error || "Invalid credentials"); diff --git a/src/app/admin/layout.tsx b/src/app/admin/layout.tsx index 7c75da9..9bfa261 100644 --- a/src/app/admin/layout.tsx +++ b/src/app/admin/layout.tsx @@ -34,6 +34,7 @@ export default function AdminLayout({ children }: { children: React.ReactNode }) if (isLoginPage) return; const token = document.cookie.match(/tia_admin_session=([^;]+)/)?.[1]; + console.log("AdminLayout: token =", token ? "found" : "NOT FOUND"); if (!token) { router.push("/admin-login"); return;