// src/lib/api/customer-portal-storage.ts
const ACCESS_KEY = "acx_cp_access"
const REFRESH_KEY = "acx_cp_refresh"

export const customerPortalTokenStorage = {
  getAccess(): string | null {
    if (typeof window === "undefined") return null
    return localStorage.getItem(ACCESS_KEY)
  },
  getRefresh(): string | null {
    if (typeof window === "undefined") return null
    return localStorage.getItem(REFRESH_KEY)
  },
  setTokens(access: string, refresh: string) {
    if (typeof window === "undefined") return
    localStorage.setItem(ACCESS_KEY, access)
    localStorage.setItem(REFRESH_KEY, refresh)
  },
  clear() {
    if (typeof window === "undefined") return
    localStorage.removeItem(ACCESS_KEY)
    localStorage.removeItem(REFRESH_KEY)
  },
}
