fix(admin): surface errors from the pet-verify and warning mutations

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.
This commit is contained in:
admin committed 2026-08-12 09:46:26 +02:00
1 parent 54fb0d55bc
commit bc2dfa9a2d
1 file changed
+10 -1
+10 -1
View File
@@ -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}`);
},
})
);