@ticketsnav/common 1.0.3 → 1.0.6
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.
|
@@ -10,5 +10,5 @@ declare global {
|
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
export declare const currentUser: (req: Request, res: Response, next: NextFunction) =>
|
|
13
|
+
export declare const currentUser: (req: Request, res: Response, next: NextFunction) => void;
|
|
14
14
|
export {};
|
|
@@ -5,10 +5,11 @@ const jwt = require("jsonwebtoken");
|
|
|
5
5
|
const currentUser = (req, res, next) => {
|
|
6
6
|
var _a;
|
|
7
7
|
if (!((_a = req.session) === null || _a === void 0 ? void 0 : _a.jwt)) {
|
|
8
|
-
return
|
|
8
|
+
return next();
|
|
9
9
|
}
|
|
10
10
|
try {
|
|
11
11
|
const payload = jwt.verify(req.session.jwt, process.env.JWT_KEY);
|
|
12
|
+
console.log(req.currentUser);
|
|
12
13
|
req.currentUser = payload;
|
|
13
14
|
}
|
|
14
15
|
catch (err) { }
|