import {
  requestErrorHandler,
  requestInterceptor,
} from "@/middleware/request-interceptor";
import {
  responseErrorHandler,
  responseInterceptor,
} from "@/middleware/response-interceptor";
import axios from "axios";

const api = axios.create({
  baseURL: process.env.NEXT_PUBLIC_API_URL,
  timeout: 10000,
  headers: {
    "Content-Type": "application/json",
  },
});

api.interceptors.request.use(requestInterceptor, requestErrorHandler);

api.interceptors.response.use(responseInterceptor, responseErrorHandler);

export default api;
