From bc2dfa9a2dd87e4401e1ae9f4a99d427c76498f8 Mon Sep 17 00:00:00 2001 From: neodk2004 Date: Wed, 12 Aug 2026 09:46:26 +0200 Subject: [PATCH] fix(admin): surface errors from the pet-verify and warning mutations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both had no onError handler, so a failed request (e.g. a permission check) silently did nothing — the verify button looked broken with no indication why. Now shows a toast on both success and failure. --- src/app/p/[secret]/users/page.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/app/p/[secret]/users/page.tsx b/src/app/p/[secret]/users/page.tsx index d4e4455..dd22692 100644 --- a/src/app/p/[secret]/users/page.tsx +++ b/src/app/p/[secret]/users/page.tsx @@ -98,7 +98,13 @@ export default function AdminUsersPage() { const verifyMutation = useMutation( trpc.admin.setPetVerified.mutationOptions({ - onSuccess: () => void qc.invalidateQueries({ queryKey: trpc.admin.listUsers.queryKey() }), + onSuccess: (pet) => { + void qc.invalidateQueries({ queryKey: trpc.admin.listUsers.queryKey() }); + toast.success(pet.isVerified ? `${pet.name} verified.` : `${pet.name} un-verified.`); + }, + onError: (err) => { + toast.error(`Verification failed: ${err.message}`); + }, }) ); @@ -118,6 +124,9 @@ export default function AdminUsersPage() { }); setWarnReason(""); }, + onError: (err) => { + toast.error(`Warning failed: ${err.message}`); + }, }) );