From f29418bfc43b58fd337adedc788bae0f947ded33 Mon Sep 17 00:00:00 2001 From: mallasorte12 Date: Wed, 23 Mar 2022 12:27:48 +0100 Subject: [PATCH] profile-info-done --- server.js | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/server.js b/server.js index f65a214..1d22df1 100644 --- a/server.js +++ b/server.js @@ -154,10 +154,10 @@ app.post("/init-user", (req, res) => { ) }); -app.post("/get-profile-info", (req, res) => { +app.post("/get-user-info", (req, res) => { const id = req.body.id; - console.log("Attempting to get player info of player: " + id); + console.log("Attempting to get user info of user: " + id); db.query("SELECT * FROM UserInfo WHERE User_id = ?", [id], (err, result) => { if (err) { console.log("There was an error"); @@ -166,7 +166,25 @@ app.post("/get-profile-info", (req, res) => { console.log("Cannot find a User with ID of " + id); } else { - console.log("Successfuly sent response with information about User with ID " + id); + console.log("Successfuly sent response with UserInfo with ID " + id); + res.send({result: result}); + } + }); +}); + +app.post("/get-user-stats", (req, res) => { + const id = req.body.id; + + console.log("Attempting to get user stats of user: " + id); + db.query("SELECT * FROM UserStats WHERE User_id = ?", [id], (err, result) => { + if (err) { + console.log("There was an error"); + } + if (result < 1){ + console.log("Cannot find a User with ID of " + id); + } + else { + console.log("Successfuly sent response with UserStats with ID " + id); res.send({result: result}); } });