"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, }; }