axios.defaults.xsrfCookieName = 'csrftoken'; axios.defaults.xsrfHeaderName = 'X-CSRFToken'; var base_url = window.location.href.split('/').slice(3, 5).join('/'); let HTTP = axios.create({ baseURL: `/api/${base_url}/` }); export default HTTP;