Fix admin refresh button layout and add status feedback
This commit is contained in:
@@ -37,8 +37,9 @@
|
||||
<label>
|
||||
Tenant ID:
|
||||
<input id="tenantId" value="default" />
|
||||
<button id="refresh" style="margin-left: 0.5rem;">Actualizar módulos</button>
|
||||
</label>
|
||||
<button id="refresh" style="margin-left: 0.5rem;">Actualizar módulos</button>
|
||||
<span id="status" style="margin-left: 1rem; color: #555;"></span>
|
||||
|
||||
<div id="modules"></div>
|
||||
|
||||
@@ -58,12 +59,17 @@
|
||||
}
|
||||
|
||||
async function api(path, options = {}) {
|
||||
const statusEl = document.getElementById('status');
|
||||
statusEl.textContent = 'Consultando ' + path + '...';
|
||||
const res = await fetch(withTenant(`${apiRoot}${path}`), options);
|
||||
const data = await res.json().catch(() => null);
|
||||
if (!res.ok) {
|
||||
const err = data?.message ? data.message : res.statusText;
|
||||
statusEl.textContent = `Error ${res.status}`;
|
||||
throw new Error(err || `HTTP ${res.status}`);
|
||||
}
|
||||
statusEl.textContent = 'OK';
|
||||
setTimeout(() => (statusEl.textContent = ''), 1500);
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user