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

31 lines
693 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"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;