Skip to content

Commit

Permalink
fix(userrole): fix userRole type to handle undefined state
Browse files Browse the repository at this point in the history
  • Loading branch information
imjulianeral committed Sep 7, 2021
1 parent 9cc9988 commit 25d6153
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/components/NextShield.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,8 @@ export function NextShield<
((isLoading || isAuth) && pathIsPublic) ||
((isLoading || userRole) && !pathIsAuthorized) ||
(isLoading && pathIsHybrid)
) {
)
return <>{LoadingComponent}</>
}

return <>{children}</>
}
2 changes: 1 addition & 1 deletion src/types/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -439,5 +439,5 @@ export type NextShieldProps<
* )
* ```
*/
userRole: string
userRole: string | undefined
}

0 comments on commit 25d6153

Please sign in to comment.