mirror of
https://github.com/formbricks/formbricks.git
synced 2025-12-30 10:19:51 -06:00
add loading spinner to auth buttons
This commit is contained in:
@@ -4,10 +4,12 @@ import { Button } from "@formbricks/ui";
|
||||
import { XCircleIcon } from "@heroicons/react/20/solid";
|
||||
import { signIn } from "next-auth/react";
|
||||
import Link from "next/dist/client/link";
|
||||
import { useState } from "react";
|
||||
import { GithubButton } from "./GithubButton";
|
||||
|
||||
export const SigninForm = ({ callbackUrl, error }) => {
|
||||
const handleSubmit = async (e) => {
|
||||
setLoggingIn(true);
|
||||
e.preventDefault();
|
||||
await signIn("credentials", {
|
||||
callbackUrl: callbackUrl || "/",
|
||||
@@ -16,6 +18,8 @@ export const SigninForm = ({ callbackUrl, error }) => {
|
||||
});
|
||||
};
|
||||
|
||||
const [loggingIn, setLoggingIn] = useState(false);
|
||||
|
||||
return (
|
||||
<>
|
||||
{error && (
|
||||
@@ -66,7 +70,7 @@ export const SigninForm = ({ callbackUrl, error }) => {
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<Button type="submit" className="w-full justify-center">
|
||||
<Button type="submit" className="w-full justify-center" loading={loggingIn}>
|
||||
Sign in
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -11,8 +11,10 @@ import { GithubButton } from "./GithubButton";
|
||||
export const SignupForm = () => {
|
||||
const router = useRouter();
|
||||
const [error, setError] = useState<string>("");
|
||||
const [signingUp, setSigningUp] = useState(false);
|
||||
|
||||
const handleSubmit = async (e) => {
|
||||
setSigningUp(true);
|
||||
e.preventDefault();
|
||||
try {
|
||||
await createUser(
|
||||
@@ -95,7 +97,7 @@ export const SignupForm = () => {
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<Button type="submit" className="w-full justify-center">
|
||||
<Button type="submit" className="w-full justify-center" loading={signingUp}>
|
||||
Sign up
|
||||
</Button>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user