From 375e24ccfe2a44e647802c360e8906a67302530e Mon Sep 17 00:00:00 2001 From: teena14 Date: Sat, 24 Jan 2026 01:57:37 +0530 Subject: [PATCH 1/2] MXWAR-36: Allow backend URL override via environment variable --- src/lib/axios.ts | 5 +++-- vite.config.ts | 34 ++++++++++++++++++++-------------- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/src/lib/axios.ts b/src/lib/axios.ts index ba61598..75ebf9a 100644 --- a/src/lib/axios.ts +++ b/src/lib/axios.ts @@ -8,7 +8,8 @@ import axios from "axios"; const fineract = axios.create({ - baseURL: "https://localhost:8443/fineract-provider/api/v1", + baseURL: "/api/v1", + headers: { "Content-Type": "application/json", Accept: "application/json", @@ -17,7 +18,7 @@ const fineract = axios.create({ }); fineract.interceptors.request.use((config) => { - const token = localStorage.getItem("mifosToken"); + const token = localStorage.getItem("mifosToken"); if (token) { config.headers["Authorization"] = `Basic ${token}`; config.headers["Fineract-Platform-TenantId"] = "default"; diff --git a/vite.config.ts b/vite.config.ts index 9006966..002a11a 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -7,23 +7,29 @@ */ import path from "path"; import tailwindcss from "@tailwindcss/vite"; -import { defineConfig } from "vite"; +import { defineConfig, loadEnv } from "vite"; import react from "@vitejs/plugin-react"; -export default defineConfig({ - plugins: [react(), tailwindcss()], - resolve: { - alias: { - "@": path.resolve(__dirname, "./src"), +export default defineConfig(({ mode }) => { + const env = loadEnv(mode, process.cwd(), ""); + + return { + plugins: [react(), tailwindcss()], + resolve: { + alias: { + "@": path.resolve(__dirname, "./src"), + }, }, - }, - server: { - proxy: { - "/api": { - target: "https://localhost:8443/fineract-provider", - changeOrigin: true, - secure: false, + server: { + proxy: { + "/api": { + target: + env.VITE_FINERACT_API_URL || + "https://localhost:8443/fineract-provider", + changeOrigin: true, + secure: false, + }, }, }, - }, + }; }); From 5b347c9de066c1aed1173ff3b08a4451efa524f0 Mon Sep 17 00:00:00 2001 From: teena14 Date: Sat, 24 Jan 2026 21:40:34 +0530 Subject: [PATCH 2/2] MXWAR-36: Rename env variable to standard FINERACT_API_URL --- vite.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vite.config.ts b/vite.config.ts index 002a11a..04f1ad5 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -24,7 +24,7 @@ export default defineConfig(({ mode }) => { proxy: { "/api": { target: - env.VITE_FINERACT_API_URL || + env.FINERACT_API_URL || "https://localhost:8443/fineract-provider", changeOrigin: true, secure: false,