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.

small fix

Kiran Kf4444d0b5e60
diff --git a/apps/web/ui/webhooks/add-edit-webhook-form.tsx b/apps/web/ui/webhooks/add-edit-webhook-form.tsx
index 87fd9a2556..d0125d40d8 100644
--- a/apps/web/ui/webhooks/add-edit-webhook-form.tsx
+++ b/apps/web/ui/webhooks/add-edit-webhook-form.tsx
@@ -88,16 +88,19 @@ export default function AddEditWebhookForm({
setSaving(false);
const result = await response.json();
- if (response.ok) {
- mutate(`/api/webhooks/${result.id}?workspaceId=${workspaceId}`, result);
- toast.success(endpoint.successMessage);
+ if (!response.ok) {
+ toast.error(result.error.message);
+ return;
+ }
- if (endpoint.method === "POST") {
- router.push(`/${workspaceSlug}/settings/webhooks`);
- }
+ if (endpoint.method === "POST") {
+ mutate(`/api/webhooks?workspaceId=${workspaceId}`);
+ router.push(`/${workspaceSlug}/settings/webhooks`);
} else {
- toast.error(result.error.message);
+ mutate(`/api/webhooks/${result.id}?workspaceId=${workspaceId}`, result);
}
+
+ toast.success(endpoint.successMessage);
};
const { name, url, secret, triggers, linkIds = [] } = data;