admin/lib/clientSessionHint.ts
alisaza e1eaf5eff5 feat: initial ghabilee-admin backoffice app
Extract admin dashboard from ghabilee-frontend2 into a dedicated Next.js
app for backoffice.ghabilee.ir (no SEO indexing / Clarity).
2026-09-05 13:12:59 +03:30

15 lines
492 B
TypeScript

import Cookies from 'js-cookie'
/**
* Synchronous client-only hint that a consumer session likely exists.
* Used to suppress guest marketing / nationwide feed flash before AuthContext
* finishes hydrating from localStorage (CLS on `/`).
*
* Returns false during SSR — guest ISR HTML stays unchanged.
*/
export function hasClientSessionHint(): boolean {
if (typeof window === 'undefined') return false
return Boolean(Cookies.get('accessToken') || localStorage.getItem('user'))
}