File tree Expand file tree Collapse file tree 3 files changed +7
-4
lines changed
Expand file tree Collapse file tree 3 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -117,6 +117,6 @@ export async function getUserInfoForNav() {
117117 } )
118118 } catch ( error ) {
119119 console . log ( error ) ;
120- throw error ;
120+ return null ;
121121 }
122122}
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ export default async function RootLayout({
2121} > ) {
2222 const session = await auth ( ) ;
2323 const userId = session ?. user ?. id || null ;
24+ const isLoggedIn = Boolean ( userId ) ;
2425
2526 // Don't rely on session.user.image here: with JWT sessions it won't change
2627 // until the token is refreshed (often only on re-login).
@@ -33,7 +34,7 @@ export default async function RootLayout({
3334 < html lang = "en" >
3435 < body >
3536 < Providers profileComplete = { profileComplete } userId = { userId } >
36- < TopNav userInfo = { userInfo } isAdmin = { isAdmin } />
37+ < TopNav userInfo = { userInfo } isLoggedIn = { isLoggedIn } isAdmin = { isAdmin } />
3738 < main className = "container mx-auto" >
3839 { children }
3940 </ main >
Original file line number Diff line number Diff line change @@ -18,11 +18,13 @@ type Props = {
1818 name : string | null ;
1919 image : string | null ;
2020 } | null ;
21+ isLoggedIn : boolean ;
2122 isAdmin : boolean ;
2223} ;
2324
2425export default function TopNav ( {
2526 userInfo,
27+ isLoggedIn,
2628 isAdmin,
2729} : Props ) {
2830
@@ -71,7 +73,7 @@ export default function TopNav({
7173 </ div >
7274 </ NavbarBrand >
7375 < NavbarContent justify = "center" >
74- { userInfo &&
76+ { isLoggedIn &&
7577 links . map ( ( item ) => (
7678 < NavLink
7779 key = { item . href }
@@ -84,7 +86,7 @@ export default function TopNav({
8486 justify = "end"
8587 className = "flex-1"
8688 >
87- { userInfo ? (
89+ { isLoggedIn ? (
8890 < div className = "ml-auto" >
8991 < UserMenu userInfo = { userInfo } />
9092 </ div >
You can’t perform that action at this time.
0 commit comments