Skip to content

Commit 71bea60

Browse files
fix: update handleGoogleLogin
1 parent a657da3 commit 71bea60

1 file changed

Lines changed: 5 additions & 20 deletions

File tree

src/components/modules/Auth/LoginForm.tsx

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -25,26 +25,7 @@ const LoginForm = ({ redirectPath }: LoginFormProps) => {
2525
const { mutateAsync, isPending } = useMutation({
2626
mutationFn: (payload: ILoginPayload) => loginAction(payload, redirectPath),
2727
});
28-
const handleGoogleLogin = () => {
29-
const form = document.createElement("form");
30-
form.method = "POST";
31-
form.action = `${process.env.NEXT_PUBLIC_BACKEND_URL}/api/auth/sign-in/social`;
32-
33-
const provider = document.createElement("input");
34-
provider.type = "hidden";
35-
provider.name = "provider";
36-
provider.value = "google";
37-
38-
const callbackURL = document.createElement("input");
39-
callbackURL.type = "hidden";
40-
callbackURL.name = "callbackURL";
41-
callbackURL.value = "https://cinetube.arifuddincoder.site/dashboard";
42-
43-
form.appendChild(provider);
44-
form.appendChild(callbackURL);
45-
document.body.appendChild(form);
46-
form.submit();
47-
};
28+
4829
const form = useForm({
4930
defaultValues: { email: "", password: "" },
5031
onSubmit: async ({ value }) => {
@@ -62,6 +43,10 @@ const LoginForm = ({ redirectPath }: LoginFormProps) => {
6243
},
6344
});
6445

46+
const handleGoogleLogin = () => {
47+
window.location.href = `${process.env.NEXT_PUBLIC_API_BASE_URL}/auth/google?redirect=/dashboard`;
48+
};
49+
6550
return (
6651
<div className="min-h-screen grid grid-cols-1 lg:grid-cols-2">
6752
<div className="hidden lg:flex flex-col justify-between bg-[#0f0f0f] p-12">

0 commit comments

Comments
 (0)