import axios, { AxiosError } from 'axios'; import Constants from 'expo-constants'; import { logError } from '@/lib/errorLogger'; const api = axios.create({ baseURL: Constants?.expoConfig?.extra?.URL_API }); api.interceptors.response.use( (response) => response, (error: AxiosError) => { const status = error.response?.status; const url = error.config?.url ?? 'unknown endpoint'; const description = `API error ${status ?? 'network'} on ${url}`; logError(description, error); return Promise.reject(error); } ); export default api;