Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

axios.interceptors.response.use

// Add a response interceptor
HTTP.interceptors.response.use(function (response) {
 return response
}, function(error) {
 if (error.response.status === 401) {
  store.dispatch('logout')
  router.push('/login')
 }
 return Promise.reject(error.response.data)
})
Comment

axios interceptors

	axios.interceptors.request.use((value) => {
		value.headers = {
			'Access-Control-Allow-Origin': '*',
			'Access-Control-Allow-Methods': '*',
			'Access-Control-Allow-Headers': '*',
			'Accept': 'application/json',
			'Content-Type': 'application/json'
		}
		return value
	})
Comment

PREVIOUS NEXT
Code Example
::  
::  
::  
::  
:: change array of object to object without index value 
::  
::  
Javascript ::  
::  
Javascript ::  
Javascript ::  
Javascript ::  
::  
::  
::  
::  
:: require mongoose 
::  
Javascript ::  
::  
::  
:: innertext of element js 
Javascript ::  
::  
::  
:: int to string javascript 
::  
::  
::  
Javascript ::  
ADD CONTENT
Topic
Content
Source link
Name
4+8 =