File tree Expand file tree Collapse file tree
src/components/modules/Auth Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import AppSubmitButton from "@/components/shared/form/AppSubmitButton";
77import Logo from "@/components/shared/Logo/Logo" ;
88import { Alert , AlertDescription } from "@/components/ui/alert" ;
99import { Button } from "@/components/ui/button" ;
10+ import { authClient } from "@/lib/auth-client" ;
1011import { IRegisterPayload , registerZodSchema } from "@/zod/auth.validation" ;
1112import { useForm } from "@tanstack/react-form" ;
1213import { useMutation } from "@tanstack/react-query" ;
@@ -37,7 +38,12 @@ const RegisterForm = () => {
3738 }
3839 } ,
3940 } ) ;
40-
41+ const handleGoogleLogin = async ( ) => {
42+ await authClient . signIn . social ( {
43+ provider : "google" ,
44+ callbackURL : `${ process . env . NEXT_PUBLIC_API_BASE_URL } /auth/google/success` ,
45+ } ) ;
46+ } ;
4147 return (
4248 < div className = "min-h-screen grid grid-cols-1 lg:grid-cols-2" >
4349 < div className = "hidden lg:flex flex-col justify-between bg-[#0f0f0f] p-12" >
@@ -153,13 +159,7 @@ const RegisterForm = () => {
153159 < div className = "flex-1 h-px bg-border" />
154160 </ div >
155161
156- < Button
157- variant = "outline"
158- className = "w-full"
159- onClick = { ( ) => {
160- window . location . href = `${ process . env . NEXT_PUBLIC_API_BASE_URL } /auth/google?redirect=/dashboard` ;
161- } }
162- >
162+ < Button variant = "outline" className = "w-full" onClick = { ( ) => handleGoogleLogin ( ) } >
163163 < svg className = "size-4 mr-2" viewBox = "0 0 24 24" >
164164 < path
165165 fill = "#4285F4"
You can’t perform that action at this time.
0 commit comments