acp listings sync

This commit is contained in:
ntr committed 2022-11-28 10:46:19 +11:00
1 parent 631942bb41
commit dfc783c936
7 files changed
+33 -13

No files matched your search

+9 -5
View File
@@ -70,9 +70,9 @@ function Home() {
const offers = useSelector((state: State) => state.acpOffers);
const ws = useSelector((state: State) => state.ws);
// useEffect(() => {
// ws.sendAcpOffers();
// }, [offers, ws]);
function sync() {
ws.sendAcpListingsSync();
}
if (!offers.length) {
return (
@@ -83,8 +83,12 @@ function Home() {
}
return (
<div class='bundles'>
{offers.map(SellerGroup)}
<div>
<button onClick={sync}> sync listings </button>
<hr />
<div class='bundles'>
{offers.map(SellerGroup)}
</div>
</div>
);
}
+1
View File
@@ -52,6 +52,7 @@ const reducer = combineReducers({
const store = createStore(
reducer,
// @ts-ignore -- devtools window exists on dev
window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
);
+5
View File
@@ -50,6 +50,10 @@ export default function createSocket(dispatch) {
send(['AcpOfferStatusSet', { id, status }]);
}
function sendAcpListingsSync() {
send(['AcpListingsSync', {}]);
}
let pongTimeout;
function onPong() {
pongTimeout = setTimeout(sendPing, 5000);
@@ -154,5 +158,6 @@ export default function createSocket(dispatch) {
sendAcpOffers,
sendAcpOfferStatusSet,
sendAcpListingsSync,
};
}