chore(frontend): reduce redundancies
This commit is contained in:
1 parent
dac5d201cd
commit
75dac1e459
8 files changed
+65
-97
No files matched your search
@@ -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' });
|
||||
|
||||
Reference in new issue
Block a user