mirror of
https://github.com/formbricks/formbricks.git
synced 2026-01-26 10:42:16 -06:00
* pass inviteToken through github / google redirect url * keep invite token when switching between signup and login
33 lines
686 B
TypeScript
33 lines
686 B
TypeScript
"use client";
|
|
|
|
import { Button } from "@formbricks/ui";
|
|
import { signIn } from "next-auth/react";
|
|
import { FaGithub } from "react-icons/fa";
|
|
|
|
export const GithubButton = ({
|
|
text = "Continue with Github",
|
|
inviteUrl,
|
|
}: {
|
|
text?: string;
|
|
inviteUrl?: string | null;
|
|
}) => {
|
|
const handleLogin = async () => {
|
|
await signIn("github", {
|
|
redirect: true,
|
|
callbackUrl: inviteUrl ? inviteUrl : "/", // redirect after login to /
|
|
});
|
|
};
|
|
|
|
return (
|
|
<Button
|
|
type="button"
|
|
EndIcon={FaGithub}
|
|
startIconClassName="ml-2"
|
|
onClick={handleLogin}
|
|
variant="secondary"
|
|
className="w-full justify-center">
|
|
{text}
|
|
</Button>
|
|
);
|
|
};
|