js test with axios interceptors

This commit is contained in:
2021-09-21 11:05:29 +02:00
parent a352b9745b
commit 48292c4f81
5 changed files with 33 additions and 2 deletions

View File

@ -4,6 +4,22 @@ import axios from 'axios'
// console.log('drupalSettings', drupalSettings)
// axios.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 response interceptor, status:', status)
// if (status === 403) {
// window.location = '/'
// }
// return Promise.reject(error)
// }
// )
const MA = axios.create({
baseURL: window.location.origin + '/' + drupalSettings.path.pathPrefix,
withCredentials: true,

View File

@ -5,6 +5,20 @@ import axios from 'axios'
// console.log('drupalSettings', drupalSettings)
// console.log('window.location.origin', window.location.origin)
// axios.interceptors.response.use(
// response => {
// return Promise.resolve(response)
// },
// error => {
// const { status } = error.response
// console.warn('error in rest-axios', status)
// if (status === 403) {
// window.location = '/'
// }
// return Promise.reject(error)
// }
// )
const REST = axios.create({
baseURL: window.location.origin + '/' + drupalSettings.path.pathPrefix,
withCredentials: true,