diff --git a/.gitignore b/.gitignore index 606caf3..c62c17a 100644 --- a/.gitignore +++ b/.gitignore @@ -10,7 +10,8 @@ package-lock.json /build # OS -**.DS_Store +.DS_Store +**/.DS_Store Thumbs.db # Env diff --git a/src/.DS_Store b/src/.DS_Store deleted file mode 100644 index 20acd1e..0000000 Binary files a/src/.DS_Store and /dev/null differ diff --git a/src/lib/remote/colocation-reserve.remote.ts b/src/lib/remote/colocation-reserve.remote.ts index 1372319..d5b2f71 100644 --- a/src/lib/remote/colocation-reserve.remote.ts +++ b/src/lib/remote/colocation-reserve.remote.ts @@ -25,6 +25,18 @@ export type ReserveResult = error: string; }; +async function sendDiscordNotification(webhookUrl: string, webhookBody: unknown) { + const response = await fetch(webhookUrl, { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify(webhookBody) + }); + + if (!response.ok) { + throw new Error(`Response status: ${response.status}, Response content: ${await response.text()}`); + } +} + async function createPaymentLink(plan: string, email: string, name: string): Promise { const event = getRequestEvent(); if (!event) { @@ -64,16 +76,14 @@ async function createPaymentLink(plan: string, email: string, name: string): Pro }; if (env.COLOCATION_RESERVATION_DISCORD_WEBHOOK) { - const response = await fetch(env.COLOCATION_RESERVATION_DISCORD_WEBHOOK, { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify(webhookBody) + const notification = sendDiscordNotification( + env.COLOCATION_RESERVATION_DISCORD_WEBHOOK, + webhookBody + ).catch((error) => { + console.error('Failed to send Discord colocation reservation notification', error); }); - if (!response.ok) { - throw new Error( - `Response status: ${response.status}, Response content: ${await response.text()}` - ); - } + + event.platform?.ctx.waitUntil(notification); } else { console.log('would have called discord colocation webhook'); console.log(webhookBody); diff --git a/src/routes/+layout.ts b/src/routes/+layout.ts new file mode 100644 index 0000000..189f71e --- /dev/null +++ b/src/routes/+layout.ts @@ -0,0 +1 @@ +export const prerender = true; diff --git a/src/routes/services/colocation/+page.ts b/src/routes/services/colocation/+page.ts new file mode 100644 index 0000000..d43d0cd --- /dev/null +++ b/src/routes/services/colocation/+page.ts @@ -0,0 +1 @@ +export const prerender = false; diff --git a/src/routes/sitemap.xml/+server.ts b/src/routes/sitemap.xml/+server.ts index 2c7c116..d75e7bb 100644 --- a/src/routes/sitemap.xml/+server.ts +++ b/src/routes/sitemap.xml/+server.ts @@ -1,6 +1,8 @@ import * as sitemap from 'super-sitemap/sveltekit'; import type { RequestHandler } from '@sveltejs/kit'; +export const prerender = true; + export const GET: RequestHandler = async () => { return await sitemap.response({ origin: 'https://fyrastack.com' diff --git a/static/.DS_Store b/static/.DS_Store deleted file mode 100644 index 4cbed56..0000000 Binary files a/static/.DS_Store and /dev/null differ diff --git a/static/.assetsignore b/static/.assetsignore index 1b006a0..7767590 100644 --- a/static/.assetsignore +++ b/static/.assetsignore @@ -1,2 +1,4 @@ _worker.js -_routes.json \ No newline at end of file +_routes.json +.DS_Store +**/.DS_Store diff --git a/static/assets/.DS_Store b/static/assets/.DS_Store deleted file mode 100644 index 88f1cde..0000000 Binary files a/static/assets/.DS_Store and /dev/null differ