@ticketsnav/common 1.0.10 → 1.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,16 +4,12 @@ exports.currentUser = void 0;
4
4
  const jwt = require("jsonwebtoken");
5
5
  const currentUser = (req, res, next) => {
6
6
  var _a;
7
- console.log(req.session, 'from currentUser middleware');
8
7
  if (!((_a = req.session) === null || _a === void 0 ? void 0 : _a.jwt)) {
9
8
  return next();
10
9
  }
11
10
  try {
12
- console.log("hii from currentuser");
13
11
  const payload = jwt.verify(req.session.jwt, process.env.JWT_KEY);
14
- console.log(payload, 'from CurrentUser');
15
12
  req.currentUser = payload;
16
- console.log(req.currentUser, 'from currentUser middleware');
17
13
  }
18
14
  catch (err) { }
19
15
  next();
@@ -6,6 +6,7 @@ const errorHandler = (err, req, res, next) => {
6
6
  if (err instanceof custom_error_1.CustomError) {
7
7
  return res.status(err.statusCode).send({ errors: err.serializeErrors() });
8
8
  }
9
+ console.error(err);
9
10
  res.status(400).send({
10
11
  errors: [{ message: 'Something went wrong..' }],
11
12
  });
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.requireAuth = void 0;
4
4
  const not_authorized_error_1 = require("../errors/not-authorized-error");
5
5
  const requireAuth = (req, res, next) => {
6
- console.log(req.currentUser, ' from requireAuth');
7
6
  if (!req.currentUser) {
8
7
  throw new not_authorized_error_1.NotAuthorizedError();
9
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ticketsnav/common",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "main": "./build/index.js",
5
5
  "types": "./build/index.d.ts",
6
6
  "files": [