Updated files with tripple === and some linting issues.
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -10,7 +10,7 @@ const searchHistory = new SearchHistory();
|
||||
function searchRequestController(req, res) {
|
||||
const user = req.loggedInUser;
|
||||
const { query, page, type } = req.query;
|
||||
const username = user == undefined ? undefined : user.username;
|
||||
const username = user === undefined ? undefined : user.username;
|
||||
|
||||
Promise.resolve()
|
||||
.then(() => searchHistory.create(username, query))
|
||||
|
||||
@@ -10,7 +10,7 @@ const searchHistory = new SearchHistory();
|
||||
*/
|
||||
function historyController(req, res) {
|
||||
const user = req.loggedInUser;
|
||||
const username = user == undefined ? undefined : user.username;
|
||||
const username = user === undefined ? undefined : user.username;
|
||||
|
||||
searchHistory.read(username)
|
||||
.then((searchQueries) => {
|
||||
|
||||
@@ -22,7 +22,7 @@ function loginController(req, res) {
|
||||
.then(() => userRepository.checkAdmin(user))
|
||||
.then((checkAdmin) => {
|
||||
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 });
|
||||
})
|
||||
.catch((error) => {
|
||||
|
||||
@@ -22,8 +22,10 @@ function registerController(req, res) {
|
||||
.then(() => userRepository.checkAdmin(user))
|
||||
.then((checkAdmin) => {
|
||||
const token = new Token(user).toString(secret);
|
||||
const admin_state = checkAdmin == 1 ? true : false;
|
||||
res.send({ success: true, message: 'Welcome to Seasoned!', token, admin: admin_state });
|
||||
const admin_state = checkAdmin === 1 ? true : false;
|
||||
res.send({
|
||||
success: true, message: 'Welcome to Seasoned!', token, admin: admin_state,
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
res.status(401).send({ success: false, error: error.message });
|
||||
|
||||
Reference in New Issue
Block a user