import axios from "axios";

// const libraryApiUrl = 'https://localhost:7057/';
const libraryApiUrl = 'http://localhost:5198/';
// export const accountApiUrl = 'https://localhost:7189/Account/';
// export const userApiUrl = 'https://localhost:7189/User/';
export const accountApiUrl = 'http://localhost:5004/Account/';
export const userApiUrl = 'http://localhost:5004/User/';

// export interface AxiosRequestConfig<T = any> {
//     url?: string;
//     method?: Method;
//     baseURL?: string;
//     data?: T;
//     headers?: Record<string, string>;
//     params?: any;
//     ...
// }

export default function AxiosClient(baseUrl: string, headers?: Record<string, string>){
    return axios.create({
        baseURL: baseUrl,
        headers: headers
    });
};

export const libraryClient = AxiosClient(libraryApiUrl);

export const accountClient = AxiosClient(accountApiUrl, { 'Access-Control-Allow-Origin': '*' });
export const userClient = AxiosClient(userApiUrl, { 'Access-Control-Allow-Origin': '*' });

export const privateUserClient = AxiosClient(accountApiUrl);