- Full-featured monitoring dashboard for local web apps - Real-time status tracking with uptime percentages - Visual sparklines for status history - Add/Edit/Delete apps dynamically - Categories and color coding - Auto-refresh every 30 seconds - API endpoints for apps and status management
32 lines
997 B
JavaScript
32 lines
997 B
JavaScript
import { startTransition, useCallback } from 'react';
|
|
import { ACTION_SERVER_ACTION } from './components/router-reducer/router-reducer-types';
|
|
let globalServerActionDispatcher = null;
|
|
export function useServerActionDispatcher(dispatch) {
|
|
const serverActionDispatcher = useCallback((actionPayload)=>{
|
|
startTransition(()=>{
|
|
dispatch({
|
|
...actionPayload,
|
|
type: ACTION_SERVER_ACTION
|
|
});
|
|
});
|
|
}, [
|
|
dispatch
|
|
]);
|
|
globalServerActionDispatcher = serverActionDispatcher;
|
|
}
|
|
export async function callServer(actionId, actionArgs) {
|
|
const actionDispatcher = globalServerActionDispatcher;
|
|
if (!actionDispatcher) {
|
|
throw new Error('Invariant: missing action dispatcher.');
|
|
}
|
|
return new Promise((resolve, reject)=>{
|
|
actionDispatcher({
|
|
actionId,
|
|
actionArgs,
|
|
resolve,
|
|
reject
|
|
});
|
|
});
|
|
}
|
|
|
|
//# sourceMappingURL=app-call-server.js.map
|