From 8d9329050d08380afbe453274bf860cc138df770 Mon Sep 17 00:00:00 2001 From: Dmytro Stanchiev Date: Mon, 6 Apr 2026 23:24:40 -0400 Subject: [PATCH] fix(ui): add error handling to sign-out Add try/catch with toast notification for sign-out failures. --- src/components/sign-in.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/sign-in.tsx b/src/components/sign-in.tsx index 5bddf77..7458297 100644 --- a/src/components/sign-in.tsx +++ b/src/components/sign-in.tsx @@ -3,15 +3,19 @@ import { signOut, useSession } from "@/lib/auth-client" import { Button } from "@/components/ui/button" import { useRouter } from "next/navigation" +import { toast } from "sonner" export default function SignIn() { const { data: session, isPending } = useSession() const router = useRouter() const handleSignOut = async () => { - await signOut() - router.push("/") - router.refresh() + try { + await signOut() + router.push("/") + } catch (error) { + toast.error("Failed to sign out. Please try again.") + } } if (isPending) {