18 lines
444 B
TypeScript
18 lines
444 B
TypeScript
'use client';
|
|
|
|
import { useEffect } from 'react';
|
|
import { useAuthStore } from '@/store/authStore';
|
|
|
|
/**
|
|
* Restores customer auth on first paint from sessionStorage or refresh cookie.
|
|
* Mount once in the app shell so checkout/account see a real session.
|
|
*/
|
|
export function AuthBootstrap() {
|
|
const bootstrapAuth = useAuthStore((s) => s.bootstrapAuth);
|
|
|
|
useEffect(() => {
|
|
void bootstrapAuth();
|
|
}, [bootstrapAuth]);
|
|
|
|
return null;
|
|
}
|