import axios from "axios";
import { getToken } from "./auth";
// import { dotnetPath } from "../path/axiosPath";
// import { getToken } from "@baloise/vue-keycloak";

const axiosInstance = axios.create({
  withCredentials: false,
});

// axiosInstance.defaults.baseURL = dotnetPath;
axiosInstance.interceptors.request.use(
  async (config) => {
    const token = await getToken();
    config.headers = {
      Authorization: `Bearer ${token}`,
    };
    return config;
  },
  (error) => {
    Promise.reject(error);
  }
);

export default axiosInstance;
