接收后端請求返回?cái)r截器减宣,進(jìn)行跳轉(zhuǎn)等操作
// response攔截器, 處理response
request.interceptors.response.use((response, options) => {
response.clone().json().then(
res=>{
console.log("code:",res.code)
console.log("data:",res.data)
console.log("msg:",res.msg)
if (res.code === 302) {
document.cookie = `juno_redirect=${window.location.href}; path=/; domain=${window.location.hostname};`
location.href = res.msg
}
}
)
return response
});