logout(){
var destroySession='{"token":"'+this.token+'"}'
console.log("Session Destroy"+destroySession)
axios.post(eventBus.apiURL+'logout',{
headers: {
'Content-type': 'application/json',
},
body: destroySession,
}).then(response=>{
console.log("RESadas :: "+JSON.stringify(response.data))
alert("Logout successfully..!")
this.$router.push('/')
},error=>{
console.log(error);
alert("Some Issue for LogOut at Server Side..!")
});
window.localStorage.removeItem('token')
window.localStorage.removeItem('name')
this.$router.push('/')
}
<button @click="logout">Logout</button>
我在vuejs
书面退出代码2 AJAX POST请求,但在单击时它发送两个POST
请求和会话销毁时问题发生在服务器端。
所以你想发送2个请求到服务器,或者你有问题,因为2个请求正在发送到服务器?如果是后者,当第一个请求开始时,您可以将“禁用”属性添加到按钮。 –
问题是2请求正在发送 – AshD