Skip to content

Commit

Permalink
Load api base url at runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmarcou committed Sep 17, 2024
1 parent 9311384 commit 56f21f7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "pgtgovbotocvfrontend",
"type": "module",
"version": "0.0.3",
"version": "0.0.4",
"scripts": {
"dev": "astro dev",
"start": "astro dev",
Expand Down
4 changes: 2 additions & 2 deletions src/services/apiService.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { ProposalAttributes } from "../models/Proposal";

const { API_BASE_URL } = import.meta.env;
const { API_BASE_URL } = process.env;

export async function fetchProposal(id: number): Promise<ProposalAttributes> {
const response = await fetch(`${API_BASE_URL}/api/projects/${id}`);
Expand All @@ -13,7 +13,7 @@ export async function fetchProposal(id: number): Promise<ProposalAttributes> {

export async function fetchActiveProposals(): Promise<ProposalAttributes[]> {
const response = await fetch(
`${API_BASE_URL}/api/projects?status=FUNDING_VOTE`
`${API_BASE_URL}/api/projects?status=FUNDING_VOTE`,
);
if (!response.ok) {
throw new Error("Failed to fetch active proposals");
Expand Down

0 comments on commit 56f21f7

Please sign in to comment.