import type { AxiosRequestConfig, AxiosResponse } from 'axios' import type { ApiResponse } from '@/services/apiResponse' import axiosInstance from '@/config/axios' /** * Adapter used by generated Orval endpoints. * * OpenAPI paths include `/api/v1`, while the shared Axios instance already * uses that prefix in its base URL. Keeping the normalization here lets both * generated endpoints and the existing hand-written services share the same * authentication, refresh-token, credentials, and observability interceptors. */ export const orvalClient = (config: AxiosRequestConfig, options?: AxiosRequestConfig): Promise>> => { const url = config.url?.replace(/^\/api\/v1\/?/, '') return axiosInstance.request>({ ...config, ...options, url, headers: { ...(config.headers as Record | undefined), ...(options?.headers as Record | undefined), }, }) } export default orvalClient