added session_limit, adapted ajax calls (axios interceptor) in theme

This commit is contained in:
2021-09-16 21:40:18 +02:00
parent d26e21b5a5
commit a352b9745b
36 changed files with 197 additions and 54 deletions

View File

@@ -4,7 +4,7 @@ import axios from 'axios'
// console.log('drupalSettings', drupalSettings)
export const MA = axios.create({
const MA = axios.create({
baseURL: window.location.origin + '/' + drupalSettings.path.pathPrefix,
withCredentials: true,
headers: {
@@ -12,3 +12,21 @@ export const MA = axios.create({
// "X-CSRF-Token": "csrf_token"
}
})
MA.interceptors.response.use(
response => {
// console.log('ma-axios interceptor response', response)
return Promise.resolve(response)
// return 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