From 699f06128120d893e5e23d2243266b66ab7d2ace Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme Date: Mon, 16 Sep 2013 22:01:52 +0200 Subject: [PATCH] [TASK] Implement GET /user. --- src/User.api.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/User.api.js b/src/User.api.js index cb4b575..621145a 100644 --- a/src/User.api.js +++ b/src/User.api.js @@ -49,7 +49,17 @@ var constructor = function(db) { } if(req.method == "GET") { - res.send(200, JSON.stringify(req.session.data.user)); + if(req.session.data.login == true) { + res.send(200, JSON.stringify({ + "success": true, + "data": req.session.data.user + })); + } else { + res.send(200, JSON.stringify({ + "success": false, + "error": "You are not logged in!" + })); + } } if(req.method == "POST") {