acp listings sync
This commit is contained in:
1 parent
631942bb41
commit
dfc783c936
7 files changed
+33
-13
No files matched your search
@@ -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>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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__()
|
||||
);
|
||||
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user