Fixed a bug with an empty token being sent on a new connection
This commit is contained in:
parent
81d311eb7f
commit
1133fe2d2b
@ -49,7 +49,8 @@ function Game() {
|
|||||||
[token.id]: token
|
[token.id]: token
|
||||||
}));
|
}));
|
||||||
for (let connection of Object.values(connections)) {
|
for (let connection of Object.values(connections)) {
|
||||||
connection.send({ id: "token", data: token });
|
const data = { [token.id]: token };
|
||||||
|
connection.send({ id: "token", data });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,10 +62,9 @@ function Game() {
|
|||||||
setImageSource(URL.createObjectURL(imageDataRef.current));
|
setImageSource(URL.createObjectURL(imageDataRef.current));
|
||||||
}
|
}
|
||||||
if (data.id === "token") {
|
if (data.id === "token") {
|
||||||
const token = data.data;
|
|
||||||
setMapTokens(prevMapTokens => ({
|
setMapTokens(prevMapTokens => ({
|
||||||
...prevMapTokens,
|
...prevMapTokens,
|
||||||
[token.id]: token
|
...data.data
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user