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.
This commit is contained in:
parent
4905f9ed53
commit
eff824a4ad
@ -13,9 +13,16 @@ export const APP_ID = '434';
|
|||||||
declare global {
|
declare global {
|
||||||
interface Window { __RUNTIME_CONFIG__?: Record<string, string> }
|
interface Window { __RUNTIME_CONFIG__?: Record<string, string> }
|
||||||
}
|
}
|
||||||
|
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 =
|
export const BASE_URL =
|
||||||
(typeof window !== 'undefined' && window.__RUNTIME_CONFIG__?.VITE_ZINO_API_URL) ||
|
runtimeApiURL === 'SAME_ORIGIN'
|
||||||
'https://dev.getzino.in';
|
? window.location.origin.replace(/\/$/, '')
|
||||||
|
: runtimeApiURL || 'https://dev.getzino.in';
|
||||||
|
|
||||||
// --- Order Booking (src/docs/api/order_booking.md) ---
|
// --- Order Booking (src/docs/api/order_booking.md) ---
|
||||||
export const ORDER_BOOKING = {
|
export const ORDER_BOOKING = {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user