/** Dispatched after a successful access-token refresh so realtime can reconnect with the new cookie. */
export const ACCESS_TOKEN_REFRESHED_EVENT = 'dyolink:access-token-refreshed';

export function notifyAccessTokenRefreshed() {
  if (typeof window === 'undefined') return;
  window.dispatchEvent(new Event(ACCESS_TOKEN_REFRESHED_EVENT));
}

export function accessTokenRefreshedEventName() {
  return ACCESS_TOKEN_REFRESHED_EVENT;
}
