6d2711e36e
Default to beenvoice.soconnor.dev with server settings hidden behind Advanced; add Entities tab with clients/businesses, invoice creation, UI fixes for dashboard layout, date fields, FAB position, and card-matched button radius. Co-authored-by: Cursor <cursoragent@cursor.com>
26 lines
722 B
TypeScript
26 lines
722 B
TypeScript
import Constants from "expo-constants";
|
|
|
|
/** Production API used by default (App Store review + production builds). */
|
|
export const DEFAULT_API_URL = "https://beenvoice.soconnor.dev";
|
|
|
|
let runtimeOverride: string | null = null;
|
|
|
|
export function setRuntimeApiUrl(url: string | null) {
|
|
runtimeOverride = url?.replace(/\/$/, "") ?? null;
|
|
}
|
|
|
|
export function getApiUrl() {
|
|
if (runtimeOverride) return runtimeOverride;
|
|
|
|
const fromEnv = process.env.EXPO_PUBLIC_API_URL?.trim();
|
|
if (fromEnv) return fromEnv.replace(/\/$/, "");
|
|
|
|
const hostUri = Constants.expoConfig?.hostUri;
|
|
if (hostUri && __DEV__) {
|
|
const host = hostUri.split(":")[0];
|
|
if (host) return `http://${host}:3000`;
|
|
}
|
|
|
|
return DEFAULT_API_URL;
|
|
}
|