js test with axios interceptors

This commit is contained in:
Bachir Soussi Chiadmi 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) // 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({ const MA = axios.create({
baseURL: window.location.origin + '/' + drupalSettings.path.pathPrefix, baseURL: window.location.origin + '/' + drupalSettings.path.pathPrefix,
withCredentials: true, withCredentials: true,

View File

@ -5,6 +5,20 @@ import axios from 'axios'
// console.log('drupalSettings', drupalSettings) // console.log('drupalSettings', drupalSettings)
// console.log('window.location.origin', window.location.origin) // 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({ const REST = axios.create({
baseURL: window.location.origin + '/' + drupalSettings.path.pathPrefix, baseURL: window.location.origin + '/' + drupalSettings.path.pathPrefix,
withCredentials: true, withCredentials: true,

View File

@ -133,7 +133,7 @@ export default {
} }
}, },
beforeMount () { beforeMount () {
console.log(this.item.id, this.samples) // console.log(this.item.id, this.samples)
}, },
methods: { methods: {
...mapActions({ ...mapActions({

View File

@ -3,7 +3,7 @@ export default {
directives: { directives: {
lazy: { lazy: {
bind (figure, binding) { bind (figure, binding) {
console.log('directive lazy bind', figure, binding) // console.log('directive lazy bind', figure, binding)
// show only the first image // show only the first image
if (binding.value === 0) { if (binding.value === 0) {
const img = figure.querySelector('img:not(.blank)') const img = figure.querySelector('img:not(.blank)')

View File

@ -169,6 +169,7 @@ export default {
}) })
.catch((error) => { .catch((error) => {
console.warn('Issue with getResults', error) console.warn('Issue with getResults', error)
// window.location.reload()
Promise.reject(error) Promise.reject(error)
}) })
}, },