File tree Expand file tree Collapse file tree 1 file changed +9
-12
lines changed
Expand file tree Collapse file tree 1 file changed +9
-12
lines changed Original file line number Diff line number Diff line change @@ -6,27 +6,24 @@ import CalcLogo from "../components/CalcLogo"
66
77import { authClient } from "../lib/auth-client" ;
88import { Avatar , AvatarFallback , AvatarImage } from "../components/ui/avatar"
9- import { useEffect , useState } from "react" ;
9+ import { useState } from "react" ;
1010
1111function RootLayout ( ) {
1212
1313 const oldSession = authClient . useSession ( ) ;
1414
1515 const [ session , setSession ] = useState ( oldSession )
1616
17- useEffect ( ( ) => {
17+ // function to get the session
18+ const initializeSession = async ( ) => {
19+ await authClient . getSession ( ) ; // getting session value
1820
19- const initializeSession = async ( ) => {
20- await authClient . getSession ( ) ; // getting session value
21+ const newSession = authClient . useSession ( )
22+
23+ setSession ( newSession ) ;
24+ }
2125
22- const newSession = authClient . useSession ( )
23-
24- setSession ( newSession ) ;
25- }
26-
27- initializeSession ( )
28-
29- } , [ ] )
26+ initializeSession ( )
3027
3128 return (
3229 < >
You can’t perform that action at this time.
0 commit comments