chore(frontend): reduce redundancies

This commit is contained in:
Shivering Ocelot committed 2026-09-21 15:18:22 -05:00
1 parent dac5d201cd
commit 75dac1e459
8 files changed
+65 -97

No files matched your search

+8
View File
@@ -157,6 +157,14 @@ export function sendAction(action, body = {}, callback = null) {
return deferred.promise;
}
export async function act (action, body, { alert = null, cache = null } = {}) {
const res = await sendAction(action, body);
if (res.error) { ui.alert(`Error: ${res.error}`); return null; }
if (cache) invalidateCache(cache);
if (alert) ui.alert(alert);
return res;
}
export function ping() {
if (socket && socket.readyState === WebSocket.OPEN) {
const data = JSON.stringify({ path: 'ping' });