@jeffkk/common 1.0.7 → 1.0.9
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.
|
@@ -5,7 +5,7 @@ const custom_errors_1 = require("./custom-errors");
|
|
|
5
5
|
class NotFoundError extends custom_errors_1.CustomError {
|
|
6
6
|
constructor() {
|
|
7
7
|
super();
|
|
8
|
-
this.statusCode =
|
|
8
|
+
this.statusCode = 404;
|
|
9
9
|
this.reason = 'Route Not Found';
|
|
10
10
|
// ... because we are extending as built in class
|
|
11
11
|
Object.setPrototypeOf(this, NotFoundError.prototype);
|
|
@@ -5,15 +5,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.currentUser = void 0;
|
|
7
7
|
const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
|
|
8
|
-
console.log('middleware current user')
|
|
8
|
+
//console.log('middleware current user')
|
|
9
9
|
const currentUser = (req, res, next) => {
|
|
10
10
|
var _a;
|
|
11
|
-
console.log('middleware current user2')
|
|
11
|
+
//console.log('middleware current user2')
|
|
12
12
|
if (!((_a = req.session) === null || _a === void 0 ? void 0 : _a.jwt)) {
|
|
13
|
-
console.log('middleware no session')
|
|
13
|
+
// console.log('middleware no session')
|
|
14
14
|
return next();
|
|
15
15
|
}
|
|
16
|
-
console.log('middleware session')
|
|
16
|
+
//console.log('middleware session')
|
|
17
17
|
try {
|
|
18
18
|
const payload = jsonwebtoken_1.default.verify(req.session.jwt, process.env.JWT_KEY);
|
|
19
19
|
req.currentUser = payload;
|