first api request for search is working

This commit is contained in:
2023-08-14 13:47:32 +02:00
parent 749ffd3867
commit 97b4c9c098
4 changed files with 117 additions and 42 deletions

33
src/api/ma-axios.js Normal file
View 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