From 64c4203b21f3fefca3211482fd3c929b40aaaf91 Mon Sep 17 00:00:00 2001 From: log101 Date: Mon, 29 Jul 2024 18:42:23 +0300 Subject: [PATCH] chore: get urls from environment --- astro.config.mjs | 3 ++- src/components/LockedContent/serverUtils.ts | 9 ++++++--- src/pages/index.astro | 2 +- src/pages/x/index.astro | 9 ++++++--- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/astro.config.mjs b/astro.config.mjs index 55a3752..712a301 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -9,5 +9,6 @@ export default defineConfig({ integrations: [react(), tailwind({ applyBaseStyles: false })], - output: "static" + output: "static", + site: "https://konulukonum.log101.dev" }); diff --git a/src/components/LockedContent/serverUtils.ts b/src/components/LockedContent/serverUtils.ts index 031dcfd..4aaf75f 100644 --- a/src/components/LockedContent/serverUtils.ts +++ b/src/components/LockedContent/serverUtils.ts @@ -2,9 +2,12 @@ // each time "show content" button is clicked function incrementUnlockCounter(id: string | undefined) { if (id) { - fetch(`http://localhost:3000/api/location/increment/${id}`, { - method: "PATCH", - }) + fetch( + `${import.meta.env.PUBLIC_BACKEND_URL}/api/location/increment/${id}`, + { + method: "PATCH", + } + ) } } diff --git a/src/pages/index.astro b/src/pages/index.astro index 8cc9a67..af4c008 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -15,7 +15,7 @@ import { Loader2 } from "lucide-react"

- Konulu Konum + Konulu Konum

3 basit adımda fotoğraflarınızı ve videolarınızı

- Konulu Konum + Konulu Konum

Size bir konulu konum bırakıldı, görüntüleyebilmek için haritadaki @@ -125,7 +125,9 @@ import { CalendarIcon } from "@radix-ui/react-icons" type Content = ContentTable - const res = await fetch(`http://localhost:3000/api/location/${id}`) + const res = await fetch( + `${import.meta.env.PUBLIC_BACKEND_URL}/api/location/${id}` + ) const data: Content | null = res.status === 200 ? await res.json() : null @@ -153,7 +155,8 @@ import { CalendarIcon } from "@radix-ui/react-icons" const content = document.getElementById( "content" ) as HTMLImageElement | null - if (content) content.src = `http://localhost:3000/images/${data?.blob_url}` + if (content) + content.src = `${import.meta.env.PUBLIC_BACKEND_URL}/images/${data?.blob_url}` const counter = document.getElementById("counter") if (counter) counter.innerText = data?.unlocked_counter.toString() ?? ""