/**
 * Token management utilities
 * Handles access token storage and retrieval
 */

const TOKEN_KEY = 'access_token';

export const getAccessToken = (): string | null => {
  if (typeof window === 'undefined') return null;
  return localStorage.getItem(TOKEN_KEY);
};

export const setAccessToken = (token: string): void => {
  if (typeof window === 'undefined') return;
  localStorage.setItem(TOKEN_KEY, token);
};

export const clearAccessToken = (): void => {
  if (typeof window === 'undefined') return;
  localStorage.removeItem(TOKEN_KEY);
};

export const hasAccessToken = (): boolean => {
  return getAccessToken() !== null;
};
