1
0
Fork 0
This repository has been archived on 2024-02-17. You can view files and clone it, but cannot push or open issues or pull requests.
letu/public/javascripts/main.js

29 lines
520 B
JavaScript
Raw Permalink Normal View History

2021-01-21 11:06:24 +01:00
const socket = io.connect();
2020-11-03 12:54:40 +01:00
/*
Front-end Event
*/
// Disconnect
2021-01-21 11:06:24 +01:00
document.addEventListener("DOMContentLoaded", () => {
const logout = document.getElementById("logout");
if (logout)
logout.addEventListener("click", () => socket.emit("logout"));
2020-11-03 12:54:40 +01:00
});
/*
Socket Actions
*/
// Disconnect
socket.on("logout", data=>{
if(data.error){
alert(data.error.message);
}else{
window.location.href = "/";
}
2020-12-12 18:20:02 +01:00
});
2020-11-23 21:28:17 +01:00
function profilRedirect(){
document.location.href="/profil";
2021-01-21 11:06:24 +01:00
}