import store from "../store/index";
import axios from "axios";

let baseurl = store.state.baseurl;
const uploadUrl = `${baseurl}cos/upload`;

axios.interceptors.response.use(
  function (response) {
    return response;
  },
  function (error) {
    return Promise.reject(error);
  }
);
export const $http = function (method, url, data) {
  return axios({
    method,
    url: baseurl + url,
    data,
    withCredentials: true,
  });
};

export default { baseurl, uploadUrl, $http };
