(path: string, body?: unknown)
| 18 | }; |
| 19 | |
| 20 | const postAction = async (path: string, body?: unknown) => { |
| 21 | try { |
| 22 | await fetch(path, { |
| 23 | method: 'POST', |
| 24 | headers: body ? { 'Content-Type': 'application/json' } : undefined, |
| 25 | body: body ? JSON.stringify(body) : undefined, |
| 26 | }); |
| 27 | } catch { |
| 28 | // SSE will push corrected state |
| 29 | } |
| 30 | }; |
| 31 | |
| 32 | export const useRemoteActions = (): RemoteActions => { |
| 33 | const getState = () => useRemoteStore.getState(); |