21 lines
350 B
JavaScript
21 lines
350 B
JavaScript
|
let socket = io.connect();
|
||
|
/*
|
||
|
Front-end Event
|
||
|
*/
|
||
|
// Disconnect
|
||
|
document.getElementById("logout").addEventListener("click", function() {
|
||
|
socket.emit("logout")
|
||
|
});
|
||
|
|
||
|
|
||
|
/*
|
||
|
Socket Actions
|
||
|
*/
|
||
|
// Disconnect
|
||
|
socket.on("logout", data=>{
|
||
|
if(data.error){
|
||
|
alert(data.error.message);
|
||
|
}else{
|
||
|
window.location.href = "/";
|
||
|
}
|
||
|
})
|