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

@@ -5,7 +5,7 @@ import axios from 'axios'
// console.log('drupalSettings', drupalSettings)
console.log(window.location)
export const MGQ = axios.create({
const MGQ = axios.create({
baseURL: window.location.origin + '/mgq',
withCredentials: true,
headers: {
@@ -15,3 +15,19 @@ export const MGQ = axios.create({
'Content-Type': 'application/json'
}
})
MGQ.interceptors.response.use(
response => {
return Promise.resolve(response)
},
error => {
const { status } = error.response
console.warn('error in graphql-axios', status)
if (status === 403) {
window.location = '/'
}
return Promise.reject(error)
}
)
export default MGQ