Wire production domain, CORS for tenant subdomains, celery volume mounts, and nginx reverse proxy configs for apex, API, identity, auth, and wildcard tenants. Co-authored-by: Cursor <cursoragent@cursor.com>
31 lines
774 B
TypeScript
31 lines
774 B
TypeScript
"use client";
|
|
|
|
import { useEffect, useState } from "react";
|
|
import { usePathname } from "next/navigation";
|
|
import { getStoredToken } from "@/lib/auth";
|
|
|
|
/** تشخیص ورود SSO مرکزی. */
|
|
export function useHeaderSession() {
|
|
const pathname = usePathname();
|
|
const [isSsoAuth, setIsSsoAuth] = useState(false);
|
|
|
|
useEffect(() => {
|
|
const sync = () => {
|
|
setIsSsoAuth(!!getStoredToken());
|
|
};
|
|
sync();
|
|
window.addEventListener("focus", sync);
|
|
window.addEventListener("storage", sync);
|
|
return () => {
|
|
window.removeEventListener("focus", sync);
|
|
window.removeEventListener("storage", sync);
|
|
};
|
|
}, [pathname]);
|
|
|
|
return {
|
|
isAdminAuth: false,
|
|
isSsoAuth,
|
|
isLoggedIn: isSsoAuth,
|
|
};
|
|
}
|