import axios from 'axios';

export const BaseURL = "http://localhost:5000/api";


export const instance = () => {
    const data = axios.create({
      baseURL: 'http://localhost:5000/api',
    });
  
    data.interceptors.request.use(async function (config) {
      const accessToken = localStorage.getItem('token');
      if (accessToken) {
        config.headers['authorization'] = `Bearer ${accessToken}`;
      }
      return config;
    });
  
    return data;
  };
  
  export default instance;
  