Skip to content
Snippets Groups Projects
Commit 29d59f97 authored by ah3472's avatar ah3472
Browse files

logout added

parent 2f2c0b5e
No related branches found
No related tags found
No related merge requests found
......@@ -64,7 +64,7 @@ class gun{
bullets.push(create_bullet);
c_amt--;
ammoTxt.text = "Capacity: " + c_amt + "/" + g.t_ammo;
ammoTxt.text = "Ammo: " + c_amt + "/" + g.t_ammo;
}
......
......@@ -18,6 +18,18 @@ restartButton.addEventListener("click", function() {
let logOutButton = document.getElementById("logout")
logOutButton.addEventListener("click", function() {
fetch('/signOut', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
}).then(response => response.json())
.then(data => {
console.log(data);
})
.catch((error) => {
console.log('Error:', error);
})
window.location.href = "/login.html";
})
......@@ -462,7 +474,7 @@ function scaleDifficulty() {
difficulty.numOfRooms = 9;
}
difficulty.enemyHp += 1
difficulty.enemyHp += 1.5
}
function createNextLvl() {
......
......@@ -36,7 +36,7 @@ app.post("/createUser", function(req, res) {
}).catch(function(error) {
console.log(error.code);
console.log(error.message);
res.json(error);
res.status(400).json(error);
})
})
......@@ -58,10 +58,20 @@ app.post("/login", function(req, res){
}).catch(function(error){
console.log(error.code);
console.log(error.message);
res.json(error.code);
res.status(400).json(error.code);
});
});
app.post("/signOut", function(req, res) {
firebase.auth().signOut().then(function() {
console.log("Signed Out")
res.status(200)
}).catch(function(error) {
console.log(error)
res.status(400)
})
})
app.post("/updateDatabase", function(req, res) {
let userId = req.body.userId;
let email = req.body.email;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment