chore: get urls from environment

This commit is contained in:
log101 2024-07-29 18:42:23 +03:00
parent 360c51cbea
commit 64c4203b21
4 changed files with 15 additions and 8 deletions

View File

@ -9,5 +9,6 @@ export default defineConfig({
integrations: [react(), tailwind({ integrations: [react(), tailwind({
applyBaseStyles: false applyBaseStyles: false
})], })],
output: "static" output: "static",
site: "https://konulukonum.log101.dev"
}); });

View File

@ -2,9 +2,12 @@
// each time "show content" button is clicked // each time "show content" button is clicked
function incrementUnlockCounter(id: string | undefined) { function incrementUnlockCounter(id: string | undefined) {
if (id) { if (id) {
fetch(`http://localhost:3000/api/location/increment/${id}`, { fetch(
method: "PATCH", `${import.meta.env.PUBLIC_BACKEND_URL}/api/location/increment/${id}`,
}) {
method: "PATCH",
}
)
} }
} }

View File

@ -15,7 +15,7 @@ import { Loader2 } from "lucide-react"
<div> <div>
<h1 <h1
class='scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl hover:underline'> class='scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl hover:underline'>
<a href=`${import.meta.env.PUBLIC_HOME_URL}`> Konulu Konum</a> <a href=`${import.meta.env.SITE}`> Konulu Konum</a>
</h1> </h1>
<p class='leading-7 [&:not(:first-child)]:mt-6 text-2xl'> <p class='leading-7 [&:not(:first-child)]:mt-6 text-2xl'>
3 basit adımda fotoğraflarınızı ve videolarınızı <b 3 basit adımda fotoğraflarınızı ve videolarınızı <b

View File

@ -22,7 +22,7 @@ import { CalendarIcon } from "@radix-ui/react-icons"
<div class='flex flex-col'> <div class='flex flex-col'>
<h1 <h1
class='scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl hover:underline'> class='scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl hover:underline'>
<a href=`${import.meta.env.PUBLIC_HOME_URL}`> Konulu Konum</a> <a href=`${import.meta.env.SITE}`> Konulu Konum</a>
</h1> </h1>
<p class='[&:not(:first-child)]:mt-6 text-2xl'> <p class='[&:not(:first-child)]:mt-6 text-2xl'>
Size bir konulu konum bırakıldı, görüntüleyebilmek için haritadaki 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 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 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( const content = document.getElementById(
"content" "content"
) as HTMLImageElement | null ) 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") const counter = document.getElementById("counter")
if (counter) counter.innerText = data?.unlocked_counter.toString() ?? "" if (counter) counter.innerText = data?.unlocked_counter.toString() ?? ""