123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- import axios from 'axios'
- const REST = axios.create({
- baseURL: window.location.origin + '/' + drupalSettings.path.pathPrefix,
- withCredentials: true,
- headers: {
-
- 'Content-Type': 'application/json'
- }
- })
- REST.interceptors.response.use(
- response => {
- return Promise.resolve(response)
- },
- error => {
- const { status } = error.response
- console.warn('error in rest-axios', status)
- if (status === 403) {
- window.location = '/'
- }
- return Promise.reject(error)
- }
- )
- export default REST
|