From 708021c10d6b5f1aae3c8f75d0ac833b6fe96f75 Mon Sep 17 00:00:00 2001 From: Benjamin Okkema Date: Sun, 6 Oct 2024 21:00:09 -0500 Subject: [PATCH] refactor: flatten api routes --- src/components/forms/Form.svelte | 2 +- src/pages/{api => }/message.ts | 0 src/pages/{api => }/subscribe/confirm.ts | 0 src/pages/{api => }/subscribe/index.ts | 2 +- 4 files changed, 2 insertions(+), 2 deletions(-) rename src/pages/{api => }/message.ts (100%) rename src/pages/{api => }/subscribe/confirm.ts (100%) rename src/pages/{api => }/subscribe/index.ts (93%) diff --git a/src/components/forms/Form.svelte b/src/components/forms/Form.svelte index 0209630..c70debe 100644 --- a/src/components/forms/Form.svelte +++ b/src/components/forms/Form.svelte @@ -11,7 +11,7 @@ }, {}) const button: HTMLButtonElement = event.submitter button.setAttribute("disabled", "disabled") - const response = await fetch(`/api/${action}`, { + const response = await fetch(`/${action}`, { method, headers: { "Content-Type": "application/json", diff --git a/src/pages/api/message.ts b/src/pages/message.ts similarity index 100% rename from src/pages/api/message.ts rename to src/pages/message.ts diff --git a/src/pages/api/subscribe/confirm.ts b/src/pages/subscribe/confirm.ts similarity index 100% rename from src/pages/api/subscribe/confirm.ts rename to src/pages/subscribe/confirm.ts diff --git a/src/pages/api/subscribe/index.ts b/src/pages/subscribe/index.ts similarity index 93% rename from src/pages/api/subscribe/index.ts rename to src/pages/subscribe/index.ts index fd36e9b..e9cc4ff 100644 --- a/src/pages/api/subscribe/index.ts +++ b/src/pages/subscribe/index.ts @@ -37,7 +37,7 @@ export async function POST(context: APIContext) {

Hi!

Thanks for subscribing to the email list!

We promise to never send you spam, unless you specifically request it!

- Click here to confirm your subscription! + Click here to confirm your subscription!

Stay tuned for all the latest updates!

Ben

`