// Fired by every client-side call site that logs a customer in or out, so
// already-mounted Client Components (e.g. Navbar's AccountLink, which never
// unmounts across navigations) can re-check /api/account/me without needing
// a hard reload. router.refresh() alone doesn't do this — it only re-runs
// Server Components.
export const AUTH_CHANGED_EVENT = "ep-auth-changed";

export function dispatchAuthChanged() {
  window.dispatchEvent(new Event(AUTH_CHANGED_EVENT));
}
