more barcode game stuff

This commit is contained in:
legop3
2026-06-18 20:13:07 -04:00
parent 0af9d560e4
commit 7e30a856a8
10 changed files with 453 additions and 71 deletions
+19 -1
View File
@@ -67,11 +67,29 @@ export default function useBarcodeGameState() {
[socket],
);
const resetActiveGame = useCallback(
() =>
new Promise((resolve, reject) => {
socket.emit('barcodeGame:resetActive', {}, (response = {}) => {
if (response.error) {
reject(new Error(response.error));
return;
}
if (response.state) {
setState(normalizeState(response.state));
}
resolve(response);
});
}),
[socket],
);
return useMemo(
() => ({
state,
resetActiveGame,
voteForGame,
}),
[state, voteForGame],
[resetActiveGame, state, voteForGame],
);
}