import axiosOriginal from "axios";
import { useServices } from "~/composables/services";
import { API_ENDPOINTS } from "~/constants";

const config = useRuntimeConfig();

const axios = axiosOriginal.create({
    baseURL: config.public.API_BASE_URL,
});

axios.interceptors.request.use((config) => {
    // if (
    //     !config.url?.includes(API_ENDPOINTS.auth.login) &&
    //     !config.url?.includes(API_ENDPOINTS.user.sendOtp)
    // ) {
    //     const { token } = useServices();
    //     config.headers.Authorization = `Bearer ${token.value}`;
    // }

    return config;
});

export default axios;
