fix: auto-select /api for non-localhost deployments

This commit is contained in:
Oliver 2026-02-15 13:18:40 +01:00
parent 902988276c
commit 26ad6ec7fe
No known key found for this signature in database

View file

@ -1,4 +1,8 @@
const API_BASE = window.STAYSENSE_API_BASE || "http://127.0.0.1:8787";
const DEFAULT_API_BASE =
window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1"
? "http://127.0.0.1:8787"
: "/api";
const API_BASE = window.STAYSENSE_API_BASE || DEFAULT_API_BASE;
const DEVICE_TOKEN_KEY = "staysense.device_token.v1";
const SETTINGS_KEY = "staysense.settings.v1";