Skip to content

Commit

Permalink
fix: remove hardcode base api url
Browse files Browse the repository at this point in the history
  • Loading branch information
binodnepali committed Apr 29, 2024
1 parent 166ff27 commit cd237c0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
BASE_URL=http://localhost:8000/api
5 changes: 4 additions & 1 deletion src/server/getProfile.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
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 response = await fetch("http://localhost:8000/api/profile");
const response = await fetch(`${baseurl}/profile`);
return await response.json() as Profile;
};

Expand Down

0 comments on commit cd237c0

Please sign in to comment.