Skip to content

Commit 5f55844

Browse files
committed
call the right endpoint
1 parent 2a8f78f commit 5f55844

File tree

2 files changed

+24
-27
lines changed

2 files changed

+24
-27
lines changed

apps/dashboard/src/@3rdweb-sdk/react/hooks/useEngine.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ export function useEngineDeleteCloudHosted() {
263263
const res = await fetch(
264264
`${THIRDWEB_API_HOST}/v2/engine/deployments/${deploymentId}/infrastructure`,
265265
{
266-
method: "POST",
266+
method: "DELETE",
267267
headers: {
268268
"Content-Type": "application/json",
269269
},

apps/dashboard/src/components/engine/engine-instances-table.tsx

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ export const EngineInstancesTable: React.FC<EngineInstancesTableProps> = ({
135135
return (
136136
<>
137137
<TWTable
138-
title="engine instances"
138+
title="Your Engines"
139139
data={instances}
140140
columns={columns}
141141
isFetched={isFetched}
@@ -156,7 +156,7 @@ export const EngineInstancesTable: React.FC<EngineInstancesTableProps> = ({
156156
},
157157
{
158158
icon: FiTrash,
159-
text: "Remove",
159+
text: "Delete",
160160
onClick: (instance) => {
161161
trackEvent({
162162
category: "engine",
@@ -393,6 +393,25 @@ function DeleteSubscriptionModalContent(props: {
393393
reValidateMode: "onChange",
394394
});
395395

396+
const onSubmit = (data: DeleteCloudHostedInput) => {
397+
deleteCloudHosted.mutate(data, {
398+
onSuccess: () => {
399+
toast.success("Deleting Engine. Please check again in a few minutes.", {
400+
dismissible: true,
401+
duration: 10000,
402+
});
403+
404+
refetch();
405+
close();
406+
},
407+
onError: () => {
408+
toast.error(
409+
"Error deleting Engine. Please visit https://thirdweb.com/support.",
410+
);
411+
},
412+
});
413+
};
414+
396415
return (
397416
<div>
398417
<DialogHeader>
@@ -410,29 +429,7 @@ function DeleteSubscriptionModalContent(props: {
410429

411430
<div className="h-4" />
412431

413-
<form
414-
onSubmit={form.handleSubmit((data) =>
415-
deleteCloudHosted.mutate(data, {
416-
onSuccess: () => {
417-
toast.success(
418-
"Deleting Engine. Please check again in a few minutes.",
419-
{
420-
dismissible: true,
421-
duration: 10000,
422-
},
423-
);
424-
425-
refetch();
426-
close();
427-
},
428-
onError: () => {
429-
toast.error(
430-
"Error deleting Engine. Please visit https://thirdweb.com/support.",
431-
);
432-
},
433-
}),
434-
)}
435-
>
432+
<form onSubmit={form.handleSubmit(onSubmit)}>
436433
{/* Reason */}
437434
<FormControl isRequired>
438435
<FormLabel className="!text-base">
@@ -512,7 +509,7 @@ function DeleteSubscriptionModalContent(props: {
512509
className="gap-2"
513510
>
514511
{deleteCloudHosted.isPending && <Spinner className="size-4" />}
515-
Yes, delete this Engine
512+
Permanently Delete Engine
516513
</Button>
517514
</DialogFooter>
518515
</form>

0 commit comments

Comments
 (0)