how to dynamically add a component to the current page based on the global backend response value in the global filter in axios
current page refers to-I don"t know which page it is. As long as the back end responds to me with this code value, I will add this component to the current page
userActivation is the component that displays the following code when it receives the backend response values of 103 and 1002:
import userActivation from "userActivation"
import Vue form "vue"
axios.interceptors.response.use(response => {
let responseData = response.data
switch(responseData.code) {
case 103:
case 1002:
console.log(window.vue)
Vue.component("user-activation", {
template: "<button></button>"
},)
// vuerouter.replace("/userActivation")
window.vue.$loading.close()
throw SyntaxError()
break
}
return responseData
}, error => {
//
if("ECONNABORTED" === error.code) {
window.vue.$loading.close()
// window.vue.$Modal.alert({
// title: "",
// okText: "",
// onOk: () => {
// window.vue.$loading.show()
// return axios(error.config)
// }
// })
// throw SyntaxError()
} else {
//
switch(error.response.status) {
case 403:
case 404:
case 500:
case 503:
case 504:
}
return Promise.reject(error)
}
})