File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed
Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change 22import "@/styles/globals.css" ;
33import { Inter } from "@next/font/google" ;
44import Toaster from "@/components/toaster" ;
5+ import AuthStatus from "@/components/auth-status" ;
56
67const inter = Inter ( {
78 variable : "--font-inter" ,
89} ) ;
910
10- export default function RootLayout ( {
11+ export default async function RootLayout ( {
1112 children,
1213} : {
1314 children : React . ReactNode ;
1415} ) {
16+ const AuthStatusDiv = await AuthStatus ( ) ;
1517 return (
1618 < html lang = "en" >
1719 < body className = { inter . variable } >
18- < Toaster />
19- { children }
20+ < Toaster />
21+ { AuthStatusDiv }
22+ { children }
2023 </ body >
2124 </ html >
2225 ) ;
Original file line number Diff line number Diff line change 1+ import { unstable_getServerSession } from "next-auth" ;
2+
3+ export default async function AuthStatus ( ) {
4+ const session = await unstable_getServerSession ( ) ;
5+ return (
6+ < div className = "absolute top-5 w-full flex justify-center items-center" >
7+ { session && (
8+ < p className = "text-stone-200 text-sm" >
9+ Signed in as { session . user ?. email }
10+ </ p >
11+ ) }
12+ </ div >
13+ ) ;
14+ }
You can’t perform that action at this time.
0 commit comments