Skip to content

Commit 20ad8b8

Browse files
committed
fix(rbac): userRole removed from useEffect
1 parent 3160a73 commit 20ad8b8

File tree

3 files changed

+5
-13
lines changed

3 files changed

+5
-13
lines changed

example/ts-fire-example/package-lock.json

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/ts-fire-example/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"dependencies": {
1212
"firebase": "^8.7.0",
1313
"next": "11.0.1",
14-
"next-shield": "^2.0.2",
14+
"next-shield": "^2.0.3",
1515
"react": "17.0.2",
1616
"react-dom": "17.0.2",
1717
"react-firebase-hooks": "^3.0.4",

src/components/NextShield.tsx

+1-9
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,9 @@ export function NextShield<
6868
useEffect(() => {
6969
if (!isAuth && !isLoading && pathIsPrivate) replace(loginRoute)
7070
if (isAuth && !isLoading && pathIsPublic) replace(access)
71-
if (
72-
isAuth &&
73-
typeof userRole === 'string' &&
74-
!isLoading &&
75-
!pathIsHybrid &&
76-
!pathIsAuthorized
77-
)
78-
replace(access)
71+
if (isAuth && !isLoading && !pathIsHybrid && !pathIsAuthorized) replace(access)
7972
}, [
8073
replace,
81-
userRole,
8274
access,
8375
isAuth,
8476
isLoading,

0 commit comments

Comments
 (0)