From 8d248135e06a3f4263da7f9d6e0e6ffda7e57a25 Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Sun, 22 Oct 2017 17:01:58 +0200 Subject: [PATCH] Chagned from using user.username, to just the variable user. --- seasoned_api/src/searchHistory/searchHistory.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/seasoned_api/src/searchHistory/searchHistory.js b/seasoned_api/src/searchHistory/searchHistory.js index fbe2f35..1fabb31 100644 --- a/seasoned_api/src/searchHistory/searchHistory.js +++ b/seasoned_api/src/searchHistory/searchHistory.js @@ -16,7 +16,7 @@ class SearchHistory { * @returns {Promise} */ read(user) { - return this.database.all(this.queries.read, user.username) + return this.database.all(this.queries.read, user) .then(rows => rows.map(row => row.search_query)); } @@ -27,7 +27,7 @@ class SearchHistory { * @returns {Promise} */ create(user, searchQuery) { - return this.database.run(this.queries.create, [searchQuery, user.username]).catch((error) => { + return this.database.run(this.queries.create, [searchQuery, user]).catch((error) => { if (error.message.includes('FOREIGN')) { throw new Error('Could not create search history.'); }