From ef8b94eb05c3ccd8d6f52db3915b59c1629f1499 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eva=20Mill=C3=A1n?= Date: Wed, 26 Feb 2025 17:21:38 +0100 Subject: [PATCH] [ui] Set default API URL to '/' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sets the default API base URL to 'http://localhost:8000' only in development mode and '/' in every other case. The base URL can be changed with the 'VITE_API_ENDPOINT' env variable. Signed-off-by: Eva Millán --- ui/src/services/api/client.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ui/src/services/api/client.js b/ui/src/services/api/client.js index e984d3f..7f9686e 100644 --- a/ui/src/services/api/client.js +++ b/ui/src/services/api/client.js @@ -1,6 +1,7 @@ import axios from 'axios' -const base = import.meta.env.VITE_API_ENDPOINT || 'http://localhost:8000' +const defaultBase = import.meta.env.MODE === 'development' ? 'http://localhost:8000' : "/" +const base = import.meta.env.VITE_API_ENDPOINT || defaultBase export const client = axios.create({ baseURL: base,