import axios from 'axios';

const baseURL = import.meta.env.VITE_API_URL || '/api';
console.log('🔧 Axios baseURL:', baseURL);

export const client = axios.create({
  baseURL,
});

// Response interceptor for error handling
client.interceptors.response.use(
  (response) => response,
  (error) => {
    console.error('[API Error]', error.response?.status, error.response?.data);
    return Promise.reject(error);
  },
);
