From 9674be37cf6091ace78cb86d6834485ba038828f Mon Sep 17 00:00:00 2001 From: log101 Date: Mon, 29 Jul 2024 21:39:07 +0300 Subject: [PATCH] fix: get backend url from env --- src/scripts/index.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/scripts/index.ts b/src/scripts/index.ts index 462cab4..54eec48 100644 --- a/src/scripts/index.ts +++ b/src/scripts/index.ts @@ -44,10 +44,13 @@ const handleSubmit = async (e: SubmitEvent) => { const formData = new FormData(e.target as HTMLFormElement) - const res = await fetch(`http://127.0.0.1:3000/api/location`, { - method: "POST", - body: formData, - }) + const res = await fetch( + `${import.meta.env.PUBLIC_BACKEND_URL}/api/location`, + { + method: "POST", + body: formData, + } + ) if (res.status === 200) { const data = await res.json()