import axios from 'axios';

const api = axios.create({
  baseURL: import.meta.env.VITE_API_URL || 'http://localhost:5000/api',
  withCredentials: true,
  timeout: 10000,
});

api.interceptors.response.use(
  (response) => response,
  (error) => {
    // Do not force a hard redirect on 401 here.
    // React routing and auth state should handle unauthenticated users.
    return Promise.reject(error);
  }
);

export default api;
