changed api
This commit is contained in:
@@ -1,6 +1,30 @@
|
||||
import { isDevMode } from '@angular/core';
|
||||
|
||||
// QR Vitanova API (dynamic QR, settings, polling).
|
||||
export function resolveProductionApiBase(
|
||||
hostname: string = globalThis.location?.hostname ?? ''
|
||||
): string {
|
||||
|
||||
if (!hostname) {
|
||||
return 'https://qr.vitanova.network/api';
|
||||
}
|
||||
|
||||
// If app is already on qr.<domain>, use the same host.
|
||||
if (hostname.startsWith('qr.')) {
|
||||
return `https://${hostname}/api`;
|
||||
}
|
||||
|
||||
// For domains like app.paylow.online or paylow.online, target qr.paylow.online.
|
||||
const parts = hostname.split('.').filter(Boolean);
|
||||
if (parts.length >= 2) {
|
||||
const rootDomain = parts.slice(-2).join('.');
|
||||
return `https://qr.${rootDomain}/api`;
|
||||
}
|
||||
|
||||
return `https://qr.${hostname}/api`;
|
||||
}
|
||||
|
||||
// Dynamic QR API base (settings, creation, polling).
|
||||
// Dev keeps proxy for local work; production resolves from the current domain.
|
||||
export const QR_VITANOVA_API = isDevMode()
|
||||
? '/proxy/qr-vitanova/api'
|
||||
: 'https://qr.vitanova.network/api';
|
||||
: resolveProductionApiBase();
|
||||
|
||||
Reference in New Issue
Block a user