123456789101112131415161718192021222324252627282930313233 |
- import axios from 'axios'
- // https://github.com/alvar0hurtad0/drupal-vuejs-todo/blob/master/frontend/src/api/axiosInterceptor.js
- // console.log('drupalSettings', drupalSettings)
- const MA = axios.create({
- baseURL: `${window.location.origin}/api`,
- withCredentials: true,
- headers: {
- Accept: 'application/json',
- 'Content-Type': 'application/json'
- }
- })
- MA.interceptors.response.use(
- response => {
- return Promise.resolve(response)
- },
- error => {
- const { status } = error.response
- console.warn('error in ma-axios interceptor', status)
- // if (status === 403) {
- // window.location = '/'
- // }
- return Promise.reject(error)
- }
- )
- export default MA
|