Skip to content

Commit

Permalink
feat(SignInDialog): add error toast
Browse files Browse the repository at this point in the history
  • Loading branch information
BrickheadJohnny committed Nov 25, 2024
1 parent 99d59ea commit effa1ca
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/components/SignInDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
import { signIn } from "@/actions/auth";
import { signInDialogOpenAtom } from "@/config/atoms";
import { env } from "@/lib/env";
import { SignIn, User, Wallet } from "@phosphor-icons/react/dist/ssr";
import { SignIn, User, Wallet, XCircle } from "@phosphor-icons/react/dist/ssr";
import { DialogDescription } from "@radix-ui/react-dialog";
import { useMutation } from "@tanstack/react-query";
import { useAtom, useSetAtom } from "jotai";
import { shortenHex } from "lib/shortenHex";
import { toast } from "sonner";
import { createSiweMessage } from "viem/siwe";
import { useAccount, useConnect, useSignMessage } from "wagmi";
import { z } from "zod";
Expand Down Expand Up @@ -110,6 +111,13 @@ const SignInWithEthereum = () => {
return signIn({ message, signature });
},
onSuccess: () => setSignInDialogOpen(false),
onError: (error) => {
toast("Sign in error", {
description: error.message,
icon: <XCircle weight="fill" className="text-icon-error" />,
});
console.error(error);
},
});

return (
Expand Down

0 comments on commit effa1ca

Please sign in to comment.