Skip to content

Commit be66256

Browse files
committed
fix(rbac): login route deleted from getAccessRoute
1 parent 538f41e commit be66256

File tree

4 files changed

+7
-9
lines changed

4 files changed

+7
-9
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.8",
14+
"next-shield": "^2.0.9",
1515
"react": "17.0.2",
1616
"react-dom": "17.0.2",
1717
"react-firebase-hooks": "^3.0.4",

src/components/NextShield.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export function NextShield<
6363
const pathIsHybrid = verifyPath(hybridRoutes, pathname)
6464
const pathIsAuthorized =
6565
RBAC && userRole && verifyPath(RBAC[userRole].grantedRoutes, pathname)
66-
const access = getAccessRoute(RBAC, userRole, accessRoute, loginRoute)
66+
const access = getAccessRoute(RBAC, userRole, accessRoute)
6767

6868
console.log({
6969
userRole,
@@ -101,7 +101,6 @@ export function NextShield<
101101
((isLoading || userRole) && !pathIsAuthorized) ||
102102
(isLoading && pathIsHybrid)
103103
) {
104-
console.log('hey')
105104
return <>{LoadingComponent}</>
106105
}
107106

src/libs/routes.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,11 @@ export function verifyPath(routes: string[] | undefined, uri: string) {
77
export function getAccessRoute(
88
RBAC: RoleAccess<string[]> | undefined,
99
userRole: string | undefined,
10-
accessRoute: string | undefined,
11-
loginRoute: string
10+
accessRoute: string | undefined
1211
) {
1312
if (typeof accessRoute !== 'undefined') return accessRoute
1413

1514
if (RBAC && userRole) return RBAC[userRole].accessRoute
1615

17-
return loginRoute
16+
return ''
1817
}

0 commit comments

Comments
 (0)