Skip to content

Commit ce85be3

Browse files
authored
chore: accordion, rename insight topic, test webhook endpoint (#7635)
1 parent e125e74 commit ce85be3

File tree

6 files changed

+722
-655
lines changed

6 files changed

+722
-655
lines changed

apps/dashboard/src/@/api/webhook-configs.ts

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,3 +310,53 @@ export async function deleteWebhookConfig(props: {
310310
status: "success",
311311
};
312312
}
313+
314+
type TestDestinationUrlResponse =
315+
| {
316+
result: {
317+
httpStatusCode: number;
318+
httpResponseBody: string;
319+
};
320+
status: "success";
321+
}
322+
| {
323+
body: string;
324+
reason: string;
325+
status: "error";
326+
};
327+
328+
export async function testDestinationUrl(props: {
329+
teamIdOrSlug: string;
330+
projectIdOrSlug: string;
331+
destinationUrl: string;
332+
}): Promise<TestDestinationUrlResponse> {
333+
const authToken = await getAuthToken();
334+
335+
if (!authToken) {
336+
return {
337+
body: "Authentication required",
338+
reason: "no_auth_token",
339+
status: "error",
340+
};
341+
}
342+
343+
const resp = await fetch(
344+
`${NEXT_PUBLIC_THIRDWEB_API_HOST}/v1/teams/${props.teamIdOrSlug}/projects/${props.projectIdOrSlug}/webhook-configs/test-destination-url`,
345+
{
346+
body: JSON.stringify({ destinationUrl: props.destinationUrl }),
347+
headers: {
348+
Authorization: `Bearer ${authToken}`,
349+
"Content-Type": "application/json",
350+
},
351+
method: "POST",
352+
},
353+
);
354+
if (!resp.ok) {
355+
return {
356+
body: await resp.text(),
357+
reason: "unknown",
358+
status: "error",
359+
};
360+
}
361+
return await resp.json();
362+
}

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/components/create-webhook-config-modal.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { WebhookConfigModal } from "./webhook-config-modal";
55
interface CreateWebhookConfigModalProps {
66
open: boolean;
77
onOpenChange: (open: boolean) => void;
8+
onSuccess: () => void;
89
teamSlug: string;
910
projectSlug: string;
1011
topics: Topic[];
@@ -19,6 +20,7 @@ export function CreateWebhookConfigModal(props: CreateWebhookConfigModalProps) {
1920
mode="create"
2021
onOpenChange={props.onOpenChange}
2122
open={props.open}
23+
onSuccess={props.onSuccess}
2224
projectSlug={props.projectSlug}
2325
supportedChainIds={props.supportedChainIds}
2426
teamSlug={props.teamSlug}

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/components/edit-webhook-config-modal.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { WebhookConfigModal } from "./webhook-config-modal";
55
interface EditWebhookConfigModalProps {
66
open: boolean;
77
onOpenChange: (open: boolean) => void;
8+
onSuccess: () => void;
89
teamSlug: string;
910
projectSlug: string;
1011
topics: Topic[];
@@ -20,6 +21,7 @@ export function EditWebhookConfigModal(props: EditWebhookConfigModalProps) {
2021
mode="edit"
2122
onOpenChange={props.onOpenChange}
2223
open={props.open}
24+
onSuccess={props.onSuccess}
2325
projectSlug={props.projectSlug}
2426
supportedChainIds={props.supportedChainIds}
2527
teamSlug={props.teamSlug}

0 commit comments

Comments
 (0)