fix(ui): add error handling to sign-out

Add try/catch with toast notification for sign-out failures.
This commit is contained in:
2026-04-06 23:24:40 -04:00
parent e1fd7dc5a3
commit 8d9329050d

View File

@@ -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) {