From 8fbd0eb9d8f1a0e9c7ba5dccab4bc6c9a990f42d Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Thu, 8 Mar 2018 10:33:04 +0100 Subject: [PATCH] Also unpacks the value of username before passing it to searchHistory. --- seasoned_api/src/webserver/controllers/user/history.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/seasoned_api/src/webserver/controllers/user/history.js b/seasoned_api/src/webserver/controllers/user/history.js index 54b2ff0..2371c33 100644 --- a/seasoned_api/src/webserver/controllers/user/history.js +++ b/seasoned_api/src/webserver/controllers/user/history.js @@ -10,8 +10,9 @@ const searchHistory = new SearchHistory(); */ function historyController(req, res) { const user = req.loggedInUser; + const username = user == undefined ? undefined : user.username; - searchHistory.read(user) + searchHistory.read(username) .then((searchQueries) => { res.send({ success: true, searchQueries }); })