@jpbs/common 1.2.0 → 1.2.1

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.
@@ -12,5 +12,5 @@ interface IDecodedUser {
12
12
  username: string;
13
13
  role: Role;
14
14
  }
15
- export declare const authenticationGuard: (jwtSecret: string) => (req: AuthenticatedRequest, res: Response, next: NextFunction) => Promise<Response<any, Record<string, any>> | undefined>;
15
+ export declare const authenticationGuard: (jwtSecret: string) => (req: AuthenticatedRequest, res: Response, next: NextFunction) => Promise<void>;
16
16
  export {};
@@ -25,11 +25,13 @@ const authenticationGuard = (jwtSecret) => (req, res, next) => __awaiter(void 0,
25
25
  try {
26
26
  const token = req.cookies.auth_token;
27
27
  if (!token) {
28
- return res.status(http_status_codes_1.StatusCodes.UNAUTHORIZED).json({ error: "Unauthorized" });
28
+ res.status(http_status_codes_1.StatusCodes.UNAUTHORIZED).json({ error: "Unauthorized" });
29
+ return;
29
30
  }
30
31
  const isRevoked = yield (0, redisClient_1.isTokenRevoked)(token);
31
32
  if (isRevoked) {
32
- return res.status(http_status_codes_1.StatusCodes.UNAUTHORIZED).json({ error: "Token has been revoked" });
33
+ res.status(http_status_codes_1.StatusCodes.UNAUTHORIZED).json({ error: "Token has been revoked" });
34
+ return;
33
35
  }
34
36
  const decoded = jsonwebtoken_1.default.verify(token, jwtSecret);
35
37
  req.currentUser = decoded;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jpbs/common",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "main": "./build/index.js",
5
5
  "types": "./build/index.d.ts",
6
6
  "files": [