ask for updates on route changes

This commit is contained in:
ntr committed 2022-12-21 23:43:49 +11:00
1 parent 0e785e0c8c
commit 43173a833d
2 files changed
+5

No files matched your search

+2
View File
@@ -33,6 +33,8 @@ const Main = () => {
const { ws } = store.getState(); const { ws } = store.getState();
if (!ws) return null; if (!ws) return null;
if (e.url === '/acp') return ws.sendAcpOffers(); if (e.url === '/acp') return ws.sendAcpOffers();
if (e.url === '/') return ws.sendOffers();
if (e.url === '/list') return ws.sendWants();
} }
return ( return (
+3
View File
@@ -1,5 +1,7 @@
import { wantsState, wsState, userState, offersState, acpOffersState } from './store' import { wantsState, wsState, userState, offersState, acpOffersState } from './store'
import * as toast from './toast';
const SOCKET_URL = `${window.location.protocol === 'https:' ? 'wss://' : 'ws://'}${window.location.host}/api/ws`; const SOCKET_URL = `${window.location.protocol === 'https:' ? 'wss://' : 'ws://'}${window.location.host}/api/ws`;
export default function createSocket(dispatch) { export default function createSocket(dispatch) {
@@ -155,6 +157,7 @@ export default function createSocket(dispatch) {
sendWantRm, sendWantRm,
sendOffers, sendOffers,
sendWants,
sendAcpOffers, sendAcpOffers,
sendAcpOfferStatusSet, sendAcpOfferStatusSet,