import axios from "axios";
import { getToken } from "./func";

const axiosDanak = axios.create({
  baseURL: import.meta.env.VITE_DANAK_BASE_URL,
});

axiosDanak.interceptors.response.use(
  (response) => response,
  (error) => {
    return Promise.reject(error);
  }
);

axiosDanak.interceptors.request.use(async function (config) {
  const token = getToken();

  config.headers.Authorization = "Bearer " + token;
  return config;
});

export default axiosDanak;
