Updated files with tripple === and some linting issues.

This commit is contained in:
2018-05-06 18:23:29 +02:00
parent 64ede43dec
commit ed07c77b13
5 changed files with 13 additions and 14 deletions

File diff suppressed because one or more lines are too long

View File

@@ -10,7 +10,7 @@ const searchHistory = new SearchHistory();
function searchRequestController(req, res) { function searchRequestController(req, res) {
const user = req.loggedInUser; const user = req.loggedInUser;
const { query, page, type } = req.query; const { query, page, type } = req.query;
const username = user == undefined ? undefined : user.username; const username = user === undefined ? undefined : user.username;
Promise.resolve() Promise.resolve()
.then(() => searchHistory.create(username, query)) .then(() => searchHistory.create(username, query))

View File

@@ -10,7 +10,7 @@ const searchHistory = new SearchHistory();
*/ */
function historyController(req, res) { function historyController(req, res) {
const user = req.loggedInUser; const user = req.loggedInUser;
const username = user == undefined ? undefined : user.username; const username = user === undefined ? undefined : user.username;
searchHistory.read(username) searchHistory.read(username)
.then((searchQueries) => { .then((searchQueries) => {

View File

@@ -22,7 +22,7 @@ function loginController(req, res) {
.then(() => userRepository.checkAdmin(user)) .then(() => userRepository.checkAdmin(user))
.then((checkAdmin) => { .then((checkAdmin) => {
const token = new Token(user).toString(secret); const token = new Token(user).toString(secret);
const admin_state = checkAdmin == 1 ? true : false; const admin_state = checkAdmin === 1 ? true : false;
res.send({ success: true, token, admin: admin_state }); res.send({ success: true, token, admin: admin_state });
}) })
.catch((error) => { .catch((error) => {

View File

@@ -22,8 +22,10 @@ function registerController(req, res) {
.then(() => userRepository.checkAdmin(user)) .then(() => userRepository.checkAdmin(user))
.then((checkAdmin) => { .then((checkAdmin) => {
const token = new Token(user).toString(secret); const token = new Token(user).toString(secret);
const admin_state = checkAdmin == 1 ? true : false; const admin_state = checkAdmin === 1 ? true : false;
res.send({ success: true, message: 'Welcome to Seasoned!', token, admin: admin_state }); res.send({
success: true, message: 'Welcome to Seasoned!', token, admin: admin_state,
});
}) })
.catch((error) => { .catch((error) => {
res.status(401).send({ success: false, error: error.message }); res.status(401).send({ success: false, error: error.message });