From c81c63299bde07beb8bba94ec214c7d1bc5f7851 Mon Sep 17 00:00:00 2001 From: Binod Nepali Date: Mon, 29 Apr 2024 16:18:58 +0200 Subject: [PATCH] fix: base url undefined --- src/server/getProfile.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/server/getProfile.ts b/src/server/getProfile.ts index 6707745..3d220ae 100644 --- a/src/server/getProfile.ts +++ b/src/server/getProfile.ts @@ -1,9 +1,8 @@ import { Profile } from "../types/Profile.ts"; -const env = Deno.env.toObject(); -const baseurl = env.BASE_URL || "http://localhost:8000/api"; - export const getProfile = async () => { + const baseurl = Deno.env.get("BASE_URL") || "http://localhost:8000/api"; + const response = await fetch(`${baseurl}/profile`); return await response.json() as Profile; };