Files
kgroad-frontend2/src/features/GoogleButton/GoogleButton.tsx
T
2024-02-29 14:22:42 +06:00

31 lines
693 B
TypeScript

"use client";
import Image from "next/image";
import "./GoogleButton.scss";
import google from "./icons/google.svg";
import { useSearchParams } from "next/navigation";
import { signIn } from "next-auth/react";
const GoogleButton = () => {
const searchParams = useSearchParams();
const callbackUrl =
searchParams.get("callbackUrl") || "/profile/personal";
const googleLogin = async () => {
await signIn("google", { callbackUrl });
};
return (
<button
type="button"
className="google-btn"
onClick={googleLogin}
>
<Image src={google} alt="Google Icon" />
Войти через Google
</button>
);
};
export default GoogleButton;