From eff824a4adbd635e8abc3bc2fe8b24ebb2a16b87 Mon Sep 17 00:00:00 2001 From: Bhanu Prakash Sai Potteri Date: Mon, 17 Aug 2026 11:37:24 +0530 Subject: [PATCH] fix: resolve SAME_ORIGIN so custom domains call their own host BASE_URL took the sentinel literally, so every call became a relative /SAME_ORIGIN/... path and login 404'd on m.krishnasales.getzino.in. Same fix already shipped in the krishna_sales desktop repo. --- src/api/config.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/api/config.ts b/src/api/config.ts index 63789f1..6631311 100644 --- a/src/api/config.ts +++ b/src/api/config.ts @@ -13,9 +13,16 @@ export const APP_ID = '434'; declare global { interface Window { __RUNTIME_CONFIG__?: Record } } +const runtimeApiURL = + typeof window !== 'undefined' ? window.__RUNTIME_CONFIG__?.VITE_ZINO_API_URL : undefined; + +// SAME_ORIGIN means "call the host that served this page": on a custom domain the +// same Ingress serves /usr and /app/, so the API is this origin. It is a sentinel +// rather than '' because the || below treats '' as absent and falls through. export const BASE_URL = - (typeof window !== 'undefined' && window.__RUNTIME_CONFIG__?.VITE_ZINO_API_URL) || - 'https://dev.getzino.in'; + runtimeApiURL === 'SAME_ORIGIN' + ? window.location.origin.replace(/\/$/, '') + : runtimeApiURL || 'https://dev.getzino.in'; // --- Order Booking (src/docs/api/order_booking.md) --- export const ORDER_BOOKING = {