From ae74b0efbd29d31aafef5d39624408ed5dd768a2 Mon Sep 17 00:00:00 2001 From: shanmukhdutt Date: Wed, 17 Jan 2024 15:58:09 +0530 Subject: [PATCH 1/2] Fixed: When calling getPermissions api duplicate permissionIds are passed in the payload(#211) --- src/store/modules/user/actions.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/store/modules/user/actions.ts b/src/store/modules/user/actions.ts index d1e31b98..66a1af0e 100644 --- a/src/store/modules/user/actions.ts +++ b/src/store/modules/user/actions.ts @@ -31,7 +31,9 @@ const actions: ActionTree = { const permissionId = process.env.VUE_APP_PERMISSION_ID; // Prepare permissions list const serverPermissionsFromRules = getServerPermissionsFromRules(); - if (permissionId) serverPermissionsFromRules.push(permissionId); + + const removeDuplicatePermissionIds = new Set(serverPermissionsFromRules) + removeDuplicatePermissionIds.add(permissionId); const serverPermissions = await UserService.getUserPermissions({ permissionIds: serverPermissionsFromRules From 350ddff100317f57e7568287f744af47ef855e7c Mon Sep 17 00:00:00 2001 From: shanmukhdutt Date: Wed, 17 Jan 2024 16:29:03 +0530 Subject: [PATCH 2/2] Implemented suggested changes --- src/store/modules/user/actions.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/store/modules/user/actions.ts b/src/store/modules/user/actions.ts index 66a1af0e..381a0620 100644 --- a/src/store/modules/user/actions.ts +++ b/src/store/modules/user/actions.ts @@ -31,12 +31,10 @@ const actions: ActionTree = { const permissionId = process.env.VUE_APP_PERMISSION_ID; // Prepare permissions list const serverPermissionsFromRules = getServerPermissionsFromRules(); - - const removeDuplicatePermissionIds = new Set(serverPermissionsFromRules) - removeDuplicatePermissionIds.add(permissionId); + if (permissionId) serverPermissionsFromRules.push(permissionId); const serverPermissions = await UserService.getUserPermissions({ - permissionIds: serverPermissionsFromRules + permissionIds: [...new Set(serverPermissionsFromRules)] }, token); const appPermissions = prepareAppPermissions(serverPermissions);