added session_limit, adapted ajax calls (axios interceptor) in theme
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user