import axios from 'axios';

// Axios Interceptor Instance
const AxiosInstance = axios.create({
  baseURL: process.env.NEXT_PUBLIC_BASE_URL || 'http://10.0.0.123:3000', // Default to localhost if NEXT_PUBLIC_BASE_URL is not set
  timeout: 1000,
  headers: { 'Content-Type': 'application/json' },
});

// You can add interceptors here if needed
AxiosInstance.interceptors.request.use(
  (config) => {
    // Modify request config here if needed
    return config;
  },
  (error) => {
    return Promise.reject(error);
  }
);

AxiosInstance.interceptors.response.use(
  (response) => {
    // Modify response data here if needed
    return response;
  },
  (error) => {
    return Promise.reject(error);
  }
);

export default AxiosInstance;