Skip to content

Commit 7afe4b0

Browse files
author
arifuddincoder
committed
fix: update google auth in registration page
1 parent 8b14a85 commit 7afe4b0

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

src/components/modules/Auth/RegisterForm.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import AppSubmitButton from "@/components/shared/form/AppSubmitButton";
77
import Logo from "@/components/shared/Logo/Logo";
88
import { Alert, AlertDescription } from "@/components/ui/alert";
99
import { Button } from "@/components/ui/button";
10+
import { authClient } from "@/lib/auth-client";
1011
import { IRegisterPayload, registerZodSchema } from "@/zod/auth.validation";
1112
import { useForm } from "@tanstack/react-form";
1213
import { 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"

0 commit comments

Comments
 (0)