@wrcb/cb-common 1.0.218 → 1.0.219
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,10 +6,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.currentUser = void 0;
|
|
7
7
|
const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
|
|
8
8
|
const currentUser = (req, res, next) => {
|
|
9
|
-
var _a;
|
|
10
9
|
// vamos apenas descobrir se o usuario esta logado. se estiver, vamos extrair o payload
|
|
11
10
|
// e setar no currentUser property
|
|
12
11
|
// se não tiver logado, outro middleware irá retornar um erro.
|
|
12
|
+
var _a;
|
|
13
|
+
console.log('🛂 currentUser middleware chamado para rota:', req.originalUrl);
|
|
14
|
+
if (!req.session) {
|
|
15
|
+
console.log('⚠️ req.session está undefined');
|
|
16
|
+
}
|
|
17
|
+
else if (!req.session.jwt) {
|
|
18
|
+
console.log('⚠️ req.session.jwt não existe');
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
console.log('✅ JWT detectado em req.session.jwt:', req.session.jwt);
|
|
22
|
+
}
|
|
13
23
|
if (!((_a = req.session) === null || _a === void 0 ? void 0 : _a.jwt)) {
|
|
14
24
|
return next();
|
|
15
25
|
}
|