@genesislcap/blank-app-seed 3.34.4 → 3.35.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.
package/.genx/package.json
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [3.35.1](https://github.com/genesiscommunitysuccess/blank-app-seed/compare/v3.35.0...v3.35.1) (2024-11-07)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* script name for react templat (GENC-892) (#388) 04e6935
|
|
9
|
+
|
|
10
|
+
## [3.35.0](https://github.com/genesiscommunitysuccess/blank-app-seed/compare/v3.34.4...v3.35.0) (2024-11-07)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* support base path in react app GENC-892 (#386) 71b299a
|
|
16
|
+
|
|
3
17
|
## [3.34.4](https://github.com/genesiscommunitysuccess/blank-app-seed/compare/v3.34.3...v3.34.4) (2024-11-06)
|
|
4
18
|
|
|
5
19
|
|
|
@@ -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
|
-
|
|
59
|
+
navigate(`/${redirectUrlByPermissionState[permissionState]}`);
|
|
58
60
|
}
|
|
59
61
|
}, [routes, isConnected, isAuthenticated, hasPermission]);
|
|
60
62
|
|