Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Fix error handling for program application form

Tim Wilsonf689210fda4f
diff --git a/apps/web/ui/partners/lander/program-application-form.tsx b/apps/web/ui/partners/lander/program-application-form.tsx
index aba3d377f5..f495f955f0 100644
--- a/apps/web/ui/partners/lander/program-application-form.tsx
+++ b/apps/web/ui/partners/lander/program-application-form.tsx
@@ -77,10 +77,6 @@ export function ProgramApplicationForm({
},
onError({ error }) {
toast.error(error.serverError);
-
- setError("root.serverError", {
- message: error.serverError,
- });
},
},
);
@@ -90,10 +86,16 @@ export function ProgramApplicationForm({
return (
<form
onSubmit={handleSubmit(async (data) => {
- await executeAsync({
+ const result = await executeAsync({
...data,
programId: program.id,
});
+
+ if (!result || result.serverError || result.validationErrors) {
+ setError("root.serverError", {
+ message: "Error submitting application.",
+ });
+ }
})}
className="flex flex-col gap-6"
>