@misalon/common 1.0.15 → 1.0.17

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.
@@ -6,15 +6,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.currentUser = void 0;
7
7
  var jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
8
8
  var currentUser = function (req, res, next) {
9
- var _a;
10
- if (!((_a = req.session) === null || _a === void 0 ? void 0 : _a.jwt)) {
9
+ var _a, _b;
10
+ console.log('[auth] Session JWT:', (_a = req.session) === null || _a === void 0 ? void 0 : _a.jwt); // Log session JWT
11
+ if (!((_b = req.session) === null || _b === void 0 ? void 0 : _b.jwt)) {
12
+ console.log('[auth] No JWT in session, skipping user authentication');
11
13
  return next();
12
14
  }
13
15
  try {
14
16
  var payload = jsonwebtoken_1.default.verify(req.session.jwt, process.env.JWT_KEY);
15
17
  req.currentUser = payload;
18
+ console.log('[auth] Current User:', req.currentUser);
19
+ }
20
+ catch (err) {
21
+ console.error('[auth] Error decoding JWT:', err);
16
22
  }
17
- catch (err) { }
18
23
  next();
19
24
  };
20
25
  exports.currentUser = currentUser;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@misalon/common",
3
- "version": "1.0.15",
3
+ "version": "1.0.17",
4
4
  "main": "./build/index.js",
5
5
  "types": "./build/index.d.ts",
6
6
  "files": [