new ui 2
This commit is contained in:
@@ -147,7 +147,13 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const API_BASE = window.location.origin;
|
||||
// API configuration from backend
|
||||
window.API_BASE = '{{ api_base }}';
|
||||
|
||||
// Helper function to construct API URLs
|
||||
function api(url) {
|
||||
return `${window.API_BASE}${url}`;
|
||||
}
|
||||
|
||||
// Room icon mapping
|
||||
const roomIcons = {
|
||||
@@ -188,14 +194,14 @@
|
||||
|
||||
try {
|
||||
// Load layout
|
||||
const layoutResponse = await fetch(`${API_BASE}/layout`);
|
||||
const layoutResponse = await fetch(api('/layout'));
|
||||
if (!layoutResponse.ok) {
|
||||
throw new Error(`Layout API error: ${layoutResponse.status}`);
|
||||
}
|
||||
const layoutData = await layoutResponse.json();
|
||||
|
||||
// Load devices for feature checks
|
||||
const devicesResponse = await fetch(`${API_BASE}/devices`);
|
||||
const devicesResponse = await fetch(api('/devices'));
|
||||
if (!devicesResponse.ok) {
|
||||
throw new Error(`Devices API error: ${devicesResponse.status}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user