diff --git a/src/api/forms.ts b/src/api/forms.ts index 46f5b50c..1d85a656 100644 --- a/src/api/forms.ts +++ b/src/api/forms.ts @@ -97,7 +97,7 @@ export interface UpdateFieldInput { } // Base URL for API endpoints -const API_URL = 'http://localhost:8000' +const API_URL = import.meta.env.VITE_API_URL || 'http://localhost:8000' // Centralized error handling for all API requests // Extracts error messages and provides consistent error format diff --git a/src/api/responses.ts b/src/api/responses.ts index cfc8be4d..71997823 100644 --- a/src/api/responses.ts +++ b/src/api/responses.ts @@ -37,7 +37,7 @@ export interface ApiResponse { data: T } -const API_URL = 'http://localhost:8000' +const API_URL = import.meta.env.VITE_API_URL || 'http://localhost:8000' async function handleResponse(response: Response): Promise { if (!response.ok) { diff --git a/src/lib/auth-client.ts b/src/lib/auth-client.ts index c2dbaa4a..6d3682ed 100644 --- a/src/lib/auth-client.ts +++ b/src/lib/auth-client.ts @@ -1,5 +1,5 @@ import { createAuthClient } from 'better-auth/react' export const authClient = createAuthClient({ - baseURL: 'http://localhost:8000', // the base url of your auth server + baseURL: import.meta.env.VITE_API_URL || 'http://localhost:8000', // the base url of your auth server })