File tree Expand file tree Collapse file tree 1 file changed +19
-3
lines changed
Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -6,11 +6,27 @@ import CalcLogo from "../components/CalcLogo"
66
77import { authClient } from "../lib/auth-client" ;
88import { Avatar , AvatarFallback , AvatarImage } from "../components/ui/avatar"
9-
10- await authClient . getSession ( ) ; // get session
9+ import { useEffect , useState } from "react" ;
1110
1211function RootLayout ( ) {
13- const session = authClient . useSession ( ) ;
12+
13+ const oldSession = authClient . useSession ( ) ;
14+
15+ const [ session , setSession ] = useState ( oldSession )
16+
17+ useEffect ( ( ) => {
18+
19+ const initializeSession = async ( ) => {
20+ await authClient . getSession ( ) ; // getting session value
21+
22+ const newSession = authClient . useSession ( )
23+
24+ setSession ( newSession ) ;
25+ }
26+
27+ initializeSession ( )
28+
29+ } , [ ] )
1430
1531 return (
1632 < >
You can’t perform that action at this time.
0 commit comments