diff --git a/frontend/src/env.ts b/frontend/src/env.ts new file mode 100644 index 0000000..bbb683a --- /dev/null +++ b/frontend/src/env.ts @@ -0,0 +1,3 @@ +const API_URL = import.meta.env.API_URL; + +export { API_URL }; \ No newline at end of file diff --git a/frontend/src/pages/player.astro b/frontend/src/pages/player.astro index b40068c..c7c3d1c 100644 --- a/frontend/src/pages/player.astro +++ b/frontend/src/pages/player.astro @@ -1,15 +1,16 @@ --- import Layout from "../layouts/Layout.astro"; import type { APIResponse, Player, Note } from "../types"; +import { API_URL } from "../env"; -const res = await fetch("https://stinky-backend.site.quack-lab.dev/player"); +const res = await fetch(`${API_URL}/player`); const data: APIResponse = await res.json(); const request = { success: true, message: "" }; if (Astro.request.method === "POST") { try { const body = await Astro.request.text(); - const res = await fetch("https://stinky-backend.site.quack-lab.dev/note/new", { + const res = await fetch(`${API_URL}/note/new`, { method: "POST", body, }); diff --git a/frontend/src/pages/player/[name].astro b/frontend/src/pages/player/[name].astro index 86cad91..6639f54 100644 --- a/frontend/src/pages/player/[name].astro +++ b/frontend/src/pages/player/[name].astro @@ -1,6 +1,7 @@ --- const { name } = Astro.params; import Layout from '../../layouts/Layout.astro'; +import { API_URL } from "../../env"; ---