diff --git a/frontend/src/routes/(app)/projects/[id]/settings/+page.server.ts b/frontend/src/routes/(app)/projects/[id]/settings/+page.server.ts index 057505b..c012a7b 100644 --- a/frontend/src/routes/(app)/projects/[id]/settings/+page.server.ts +++ b/frontend/src/routes/(app)/projects/[id]/settings/+page.server.ts @@ -105,7 +105,6 @@ export const actions: Actions = { return { message: 'Custom domain enabled' } }, disable_custom_domain: async (event) => { - return { message: 'Disable custom domain is not available yet' } const userId = event.locals.user.id const existingProject = await db.query.project.findFirst({ @@ -120,6 +119,14 @@ export const actions: Actions = { return fail(400, { message: 'Project not found' }) } + const deleteOldCustomDomain = await deleteCustomDomain( + existingProject.custom_domain_id, + ) + + if (!deleteOldCustomDomain.success) { + return { message: 'Cannot delete old custom domain' } + } + await db .update(projectTable) .set({ diff --git a/frontend/src/routes/(app)/projects/[id]/settings/+page.svelte b/frontend/src/routes/(app)/projects/[id]/settings/+page.svelte index 15302d7..483bcc7 100644 --- a/frontend/src/routes/(app)/projects/[id]/settings/+page.svelte +++ b/frontend/src/routes/(app)/projects/[id]/settings/+page.svelte @@ -65,7 +65,7 @@ -
+

Custom Domain

@@ -76,14 +76,14 @@ -

+
{#if data.project.domain_status === 'pending'} - + {:else if data.project.domain_status === 'verified'} - + {:else if data.project.domain_status === 'disabled'} - + {/if}
@@ -96,8 +96,8 @@ - - + + {#if data.project.custom_ip} {data.project.custom_ip} {:else if env.PUBLIC_SHORTENER_IP} @@ -145,7 +145,7 @@ Are you absolutely sure? - + Disabling custom domain is not available yet. @@ -173,38 +173,38 @@ {:else} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + Are you absolutely sure? + + + Your custom domain setting will remain. + + + + Cancel + { + await fetch('?/disable_custom_domain', { + method: 'POST', + headers: { + 'Content-Type': 'multipart/form-data', + }, + }) + await invalidateAll() + }}> + Continue + + + + {/if}
@@ -235,10 +235,10 @@
+ class="flex items-center justify-between gap-2"> - - + + Update Project Domain (leave blank to use default) @@ -269,7 +269,7 @@

Danger Zone

-
+
Delete Project @@ -302,7 +302,7 @@ {...attrs} bind:value={$formData.deleteShorteners} type="hidden" /> -
+
-
+