first api request for search is working
This commit is contained in:
33
src/api/ma-axios.js
Normal file
33
src/api/ma-axios.js
Normal file
@@ -0,0 +1,33 @@
|
||||
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
|
||||
Reference in New Issue
Block a user