import ax from "axios";
import { toast } from "sonner";

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

axios.interceptors.response.use(
  (response) => response,
  (error) => {
    if (error.response?.status === 403) {
      toast.error(error.response.data?.message || "Access denied");
    }
    return Promise.reject(error);
  }
);

export default axios;
