Debug login flow
This commit is contained in:
parent
754a602e48
commit
4212c1f632
2 changed files with 4 additions and 0 deletions
|
|
@ -34,6 +34,9 @@ export default function AdminLoginPage() {
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
|
|
||||||
if (res.ok && data.success) {
|
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");
|
router.push("/admin");
|
||||||
} else {
|
} else {
|
||||||
setError(data.error || "Invalid credentials");
|
setError(data.error || "Invalid credentials");
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ export default function AdminLayout({ children }: { children: React.ReactNode })
|
||||||
if (isLoginPage) return;
|
if (isLoginPage) return;
|
||||||
|
|
||||||
const token = document.cookie.match(/tia_admin_session=([^;]+)/)?.[1];
|
const token = document.cookie.match(/tia_admin_session=([^;]+)/)?.[1];
|
||||||
|
console.log("AdminLayout: token =", token ? "found" : "NOT FOUND");
|
||||||
if (!token) {
|
if (!token) {
|
||||||
router.push("/admin-login");
|
router.push("/admin-login");
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue