Skip to content

Commit

Permalink
edit Suggested changes #15
Browse files Browse the repository at this point in the history
  • Loading branch information
mohammedsalah7 committed Oct 29, 2021
1 parent 0f568d2 commit 7116e47
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 6 deletions.
1 change: 0 additions & 1 deletion server/app.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
require('env2')('.env');
const express = require('express');
const { join } = require('path');
const compression = require('compression');
Expand Down
1 change: 0 additions & 1 deletion server/controllers/users/getAllUsers.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-console */
const { getAllUsersQuery } = require('../../database/quieres');

const getAllUsers = async (req, res, next) => {
Expand Down
4 changes: 1 addition & 3 deletions server/controllers/users/login.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-console */
/* eslint-disable consistent-return */
const bcrypt = require('bcrypt');
const { loginSchema } = require('../../utils/validation/loginSchema');
Expand All @@ -20,8 +19,7 @@ const login = async (req, res, next) => {
throw new Error({ message: 'Invalid email or password' });
}
const token = await signToken(email, rows[0].id, rows[0].name, rows[0].phone, rows[0].avater);
res.cookie('token', token);
return res.json({ message: 'You are Logged Successfully' });
return res.cookie('token', token).json({ message: 'You are Logged Successfully' });
} catch (err) {
if (err.details) {
res.status(400).json({
Expand Down
2 changes: 1 addition & 1 deletion server/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('Tests Server', () => {
password: '123456987',
})
.expect(400);
expect(res.body).toEqual({ message: 'Invalid email or passwor' });
expect(res.body).toEqual({ message: 'Invalid email or password' });
});
});

Expand Down

0 comments on commit 7116e47

Please sign in to comment.