MCPcopy
hub / github.com/github/docs / useHasAccount

Function useHasAccount

components/hooks/useHasAccount.ts:13–23  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

11// For users that haven't changed their session cookies recently,
12// we also can check for the browser-set `preferred_color_mode` cookie.
13export function useHasAccount() {
14 const [hasAccount, setHasAccount] = useState<boolean | null>(null)
15
16 useEffect(() => {
17 const cookieValue = Cookies.get('color_mode')
18 const altCookieValue = Cookies.get('preferred_color_mode')
19 setHasAccount(Boolean(cookieValue || altCookieValue))
20 }, [])
21
22 return { hasAccount }
23}

Callers 1

HeaderFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected