@visns-studio/visns-components 3.2.1 → 3.2.2

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.
@@ -193,10 +193,21 @@ function Navigation({
193
193
  );
194
194
  };
195
195
 
196
+ const getFirstRolePermissions = () => {
197
+ if (
198
+ userProfile.roles &&
199
+ userProfile.roles.length > 0 &&
200
+ userProfile.roles[0].permissions.length > 0
201
+ ) {
202
+ return userProfile.roles[0].permissions.map(
203
+ (permission) => permission.name
204
+ );
205
+ }
206
+ return [];
207
+ };
208
+
196
209
  useEffect(() => {
197
- const permissions = userProfile.roles[0].permissions.map(
198
- (permission) => permission.name
199
- );
210
+ const permissions = getFirstRolePermissions();
200
211
 
201
212
  setNavData((prevNavData) => {
202
213
  const updatePermissions = (nav) => {
package/package.json CHANGED
@@ -49,7 +49,7 @@
49
49
  "react-dom": "^17.0.1"
50
50
  },
51
51
  "name": "@visns-studio/visns-components",
52
- "version": "3.2.1",
52
+ "version": "3.2.2",
53
53
  "description": "Various packages to assist in the development of our Custom Applications.",
54
54
  "main": "index.js",
55
55
  "scripts": {