File tree Expand file tree Collapse file tree 1 file changed +4
-8
lines changed
frontend/src/app/home/components/landing-page Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -12,19 +12,15 @@ const LandingPage = () => {
12
12
const router = useRouter ( ) ;
13
13
14
14
const googleLogin = useGoogleLogin ( {
15
- onSuccess : ( response ) => login ( response ) ,
15
+ onSuccess : ( response ) => {
16
+ login ( response ) ;
17
+ router . push ( "/" ) ; // Redirect to dashboard after successful login
18
+ } ,
16
19
onError : ( error ) => {
17
20
console . error ( "Login Failed:" , error ) ;
18
21
} ,
19
22
} ) ;
20
23
21
- // Redirect to dashboard if user authenticates (token is present)
22
- useEffect ( ( ) => {
23
- if ( token ) {
24
- router . push ( "/" ) ;
25
- }
26
- } , [ token , router ] ) ;
27
-
28
24
// Trigger OAuth pop up only if user is not authenticated (token is not present)
29
25
const handleLogin = ( ) => {
30
26
if ( token ) {
You can’t perform that action at this time.
0 commit comments