import { createApiClient } from '@meshkee/dashboard-core'

const API_BASE_URL =
  import.meta.env.VITE_API_BASE_URL ?? 'http://localhost:3000/api/v1'

export const api = createApiClient({
  baseUrl: API_BASE_URL,
  accessTokenKey: 'meshkee_customer_access_token',
  refreshTokenKey: 'meshkee_customer_refresh_token',
})

export const {
  apiRequest,
  getAccessToken,
  getRefreshToken,
  setTokens,
  clearTokens,
} = api

export { ApiError, isAbortError } from '@meshkee/dashboard-core'
