@frontegg/react-hooks 6.89.0 → 6.90.0-alpha.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/auth/hooks.js +5 -2
- package/index.js +1 -1
- package/node/auth/hooks.js +5 -2
- package/node/index.js +1 -1
- package/package.json +3 -3
package/auth/hooks.js
CHANGED
|
@@ -74,13 +74,16 @@ export const useIsAuthenticated = () => useSelector(({
|
|
|
74
74
|
* the return user is null if not authenticated
|
|
75
75
|
*/
|
|
76
76
|
export const useAuthUser = () => {
|
|
77
|
-
const
|
|
77
|
+
const {
|
|
78
|
+
loginUrl,
|
|
79
|
+
customLoginUrl
|
|
80
|
+
} = useAuthRoutes();
|
|
78
81
|
const onRedirectTo = useOnRedirectTo();
|
|
79
82
|
const user = useAuthUserOrNull();
|
|
80
83
|
const isSSR = typeof window === 'undefined';
|
|
81
84
|
const noUser = {};
|
|
82
85
|
if (user == null && !isSSR) {
|
|
83
|
-
onRedirectTo(
|
|
86
|
+
onRedirectTo(customLoginUrl != null ? customLoginUrl : loginUrl, {
|
|
84
87
|
refresh: true
|
|
85
88
|
});
|
|
86
89
|
return noUser;
|
package/index.js
CHANGED
package/node/auth/hooks.js
CHANGED
|
@@ -87,13 +87,16 @@ const useIsAuthenticated = () => (0, _FronteggStoreContext.useSelector)(({
|
|
|
87
87
|
*/
|
|
88
88
|
exports.useIsAuthenticated = useIsAuthenticated;
|
|
89
89
|
const useAuthUser = () => {
|
|
90
|
-
const
|
|
90
|
+
const {
|
|
91
|
+
loginUrl,
|
|
92
|
+
customLoginUrl
|
|
93
|
+
} = useAuthRoutes();
|
|
91
94
|
const onRedirectTo = useOnRedirectTo();
|
|
92
95
|
const user = useAuthUserOrNull();
|
|
93
96
|
const isSSR = typeof window === 'undefined';
|
|
94
97
|
const noUser = {};
|
|
95
98
|
if (user == null && !isSSR) {
|
|
96
|
-
onRedirectTo(
|
|
99
|
+
onRedirectTo(customLoginUrl != null ? customLoginUrl : loginUrl, {
|
|
97
100
|
refresh: true
|
|
98
101
|
});
|
|
99
102
|
return noUser;
|
package/node/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontegg/react-hooks",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.90.0-alpha.1",
|
|
4
4
|
"main": "./node/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Frontegg LTD",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@babel/runtime": "^7.18.6",
|
|
9
|
-
"@frontegg/redux-store": "6.
|
|
10
|
-
"@frontegg/types": "6.
|
|
9
|
+
"@frontegg/redux-store": "6.90.0-alpha.1",
|
|
10
|
+
"@frontegg/types": "6.90.0-alpha.1",
|
|
11
11
|
"@types/react": "*",
|
|
12
12
|
"react-redux": "^7.x"
|
|
13
13
|
},
|