Skip to content

Commit

Permalink
fix: deleted auth in localstorage token
Browse files Browse the repository at this point in the history
  • Loading branch information
marlibon committed May 17, 2023
1 parent c938bb9 commit 9a24d58
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion backend/controllers/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ module.exports.login = (req, res, next) => {
sameSite: true,
httpOnly: true,
})
.send({ token });
.send({ message: 'Вы успешно авторизованы' });
})
.catch(next);
};
Expand Down
2 changes: 1 addition & 1 deletion backend/middlewares/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const { JWT_SECRET } = require('../config');
const { UnauthorizedError } = require('../errors/UnauthorizedError');

module.exports = (req, res, next) => {
const token = req.cookies.token || req.headers.authorization?.split(' ')[1];
const token = req.cookies.token /*|| req.headers.authorization?.split(' ')[1];*/
if (!token) {
return next(new UnauthorizedError('Необходима авторизация'));
}
Expand Down

0 comments on commit 9a24d58

Please sign in to comment.