@autofleet/zehut 1.2.2 → 1.2.3

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.
package/lib/user/index.js CHANGED
@@ -15,12 +15,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.eagerLoadPermissionsMiddleware = exports.middleware = void 0;
16
16
  const ApiUser_1 = __importDefault(require("./ApiUser"));
17
17
  exports.middleware = (options = {}) => (req, res, next) => __awaiter(void 0, void 0, void 0, function* () {
18
- if (req.headers['x-af-user-id']) {
19
- req.user = new ApiUser_1.default(req.headers['x-af-user-id']);
20
- }
21
- else {
22
- req.user = new ApiUser_1.default();
18
+ const userId = req.headers['x-af-user-id'];
19
+ if (!userId) {
20
+ next();
21
+ return;
23
22
  }
23
+ req.user = new ApiUser_1.default(userId);
24
24
  if (options.eagerLoadUserPermissions) {
25
25
  yield req.user.getUserPermissions();
26
26
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autofleet/zehut",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "manage user's identity",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",