import axios from 'axios';
import { API_BASE_URL, API_V1_PREFIX } from './ApiSources';


const client = axios.create({
    baseURL: `${API_BASE_URL}${API_V1_PREFIX}`,
    timeout: 10000,
    headers: {
        'Content-Type': 'application/json',
    },
    withCredentials: true,
});

client.interceptors.request.use(
    (config) => {
        const token = localStorage.getItem('access_token');
        if (token) {
            config.headers.Authorization = `Bearer ${token}`;
        }
        return config;
    },
);
export default client;