diff options
| author | Owen Jacobson <owen@grimoire.ca> | 2025-02-20 21:15:44 -0500 |
|---|---|---|
| committer | Owen Jacobson <owen@grimoire.ca> | 2025-02-20 21:15:44 -0500 |
| commit | d0cc34800243807dc1e4d352375566fde3b0f950 (patch) | |
| tree | b77ff5c5ddc90c17684e7816ff7e24cdcc3a402d | |
| parent | d9beb27e0e1bdaff8207382b664c8bc93af2468c (diff) | |
Use axios to compute event stream URL, why not.
It's amazing what you can learn by skimming the docs.
| -rw-r--r-- | ui/lib/apiServer.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/ui/lib/apiServer.js b/ui/lib/apiServer.js index e52daff..e541d43 100644 --- a/ui/lib/apiServer.js +++ b/ui/lib/apiServer.js @@ -55,9 +55,13 @@ export async function acceptInvite(inviteId, username, password) { } export function subscribeToEvents(resumePoint) { - const eventsUrl = new URL('/api/events', window.location); - eventsUrl.searchParams.append('resume_point', resumePoint); - const evtSource = new EventSource(eventsUrl.toString()); + const eventsUrl = apiServer.getUri({ + url: '/events', + params: { + resume_point: resumePoint + } + }); + const evtSource = new EventSource(eventsUrl); // TODO: this should process all incoming events and store them. // TODO: eventually we'll need to handle expiring old info, so as not to use // infinite browser memory. |
