@genesislcap/blank-app-seed 3.34.4 → 3.35.0

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/blank-app-seed-config",
3
3
  "description": "Genesis Blank App Seed Configuration",
4
- "version": "3.34.4",
4
+ "version": "3.35.0",
5
5
  "license": "Apache-2.0",
6
6
  "scripts": {
7
7
  "lint": "eslint .",
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [3.35.0](https://github.com/genesiscommunitysuccess/blank-app-seed/compare/v3.34.4...v3.35.0) (2024-11-07)
4
+
5
+
6
+ ### Features
7
+
8
+ * support base path in react app GENC-892 (#386) 71b299a
9
+
3
10
  ## [3.34.4](https://github.com/genesiscommunitysuccess/blank-app-seed/compare/v3.34.3...v3.34.4) (2024-11-06)
4
11
 
5
12
 
@@ -8,6 +8,6 @@
8
8
  </head>
9
9
  <body>
10
10
  <div id="root"></div>
11
- <script src="/bundle.js"></script>
11
+ <script src="/bundle.js"/>
12
12
  </body>
13
13
  </html>
@@ -1,5 +1,6 @@
1
1
  import { useState, useEffect, ReactNode } from 'react';
2
2
  import { RouteObject } from 'react-router';
3
+ import { useNavigate } from 'react-router-dom';
3
4
  import isConnectedHelper from '@/helpers/isConnectedHelper';
4
5
  import isAuthenticatedHelper from '@/helpers/isAuthenticatedHelper';
5
6
  import hasPermissionHelper from '@/helpers/hasPermissionHelper';
@@ -30,13 +31,14 @@ const ProtectedGuard: React.FC<{ children: ReactNode }> = ({ children }: { child
30
31
  const isAuthenticated: boolean | null = null;
31
32
  const route = routes.find(({ path }) => path === location.pathname);
32
33
  const hasPermission = route?.data?.permissionCode ? hasPermissionHelper(route.data?.permissionCode) : true;
34
+ const navigate = useNavigate();
33
35
 
34
36
  useEffect(() => {
35
37
  isConnectedHelper().then((connectedState: boolean): void => {
36
38
  setIsConnected(connectedState);
37
39
  });
38
40
  }, []);
39
-
41
+
40
42
  useEffect((): void => {
41
43
  if (isConnected === null) {
42
44
  return;
@@ -51,10 +53,10 @@ const ProtectedGuard: React.FC<{ children: ReactNode }> = ({ children }: { child
51
53
  permissionState = PermissionState.UNKNOWN;
52
54
  } else if (hasPermission === false) {
53
55
  permissionState = PermissionState.DENIED;
54
- }
55
-
56
+ }
57
+
56
58
  if (permissionState) {
57
- window.location.href = `/${redirectUrlByPermissionState[permissionState]}`;
59
+ navigate(`/${redirectUrlByPermissionState[permissionState]}`);
58
60
  }
59
61
  }, [routes, isConnected, isAuthenticated, hasPermission]);
60
62
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/blank-app-seed",
3
3
  "description": "Genesis Blank App Seed",
4
- "version": "3.34.4",
4
+ "version": "3.35.0",
5
5
  "license": "Apache-2.0",
6
6
  "scripts": {
7
7
  "release": "semantic-release"