@wrcb/cb-common 1.0.87 → 1.0.88
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.
|
@@ -11,12 +11,10 @@ const currentUser = (req, res, next) => {
|
|
|
11
11
|
// e setar no currentUser property
|
|
12
12
|
// se não tiver logado, outro middleware irá retornar um erro.
|
|
13
13
|
if (!((_a = req.session) === null || _a === void 0 ? void 0 : _a.jwt)) {
|
|
14
|
-
console.log('entrou a qui----');
|
|
15
14
|
return next();
|
|
16
15
|
}
|
|
17
16
|
try {
|
|
18
17
|
const payload = jsonwebtoken_1.default.verify(req.session.jwt, process.env.JWT_KEY);
|
|
19
|
-
console.log('payload no currentUser', payload);
|
|
20
18
|
req.currentUser = payload;
|
|
21
19
|
}
|
|
22
20
|
catch (error) { }
|
|
@@ -6,7 +6,6 @@ const errorHandler = (err, req, res, next) => {
|
|
|
6
6
|
if (err instanceof customError_1.CustomError) {
|
|
7
7
|
return res.status(err.statusCode).send({ errors: err.serializeErrors() });
|
|
8
8
|
}
|
|
9
|
-
console.error('err===========-----------', err);
|
|
10
9
|
res.status(400).send({ errors: [{ message: 'Something went wrong' }] });
|
|
11
10
|
};
|
|
12
11
|
exports.errorHandler = errorHandler;
|