X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fviews%2FHall.vue;h=a8dfa987ae4253a2d76c9e958912b025e958854d;hb=92a523d1a74cbabcfd7d6ade45f25fa622815f0b;hp=82330ef13afccdb86c52fe0a471291a700481003;hpb=3d55deea9a2011c38d8d0067bd57fc889958bec2;p=vchess.git
diff --git a/client/src/views/Hall.vue b/client/src/views/Hall.vue
index 82330ef1..a8dfa987 100644
--- a/client/src/views/Hall.vue
+++ b/client/src/views/Hall.vue
@@ -90,7 +90,7 @@ export default {
gdisplay: "live",
games: [],
challenges: [],
- people: [], //(all) online players
+ people: [], //people in main hall
infoMessage: "",
newchallenge: {
fen: "",
@@ -381,8 +381,8 @@ export default {
else
{
this.infoMessage = "New game started: " +
- "" +
- "/game/" + data.gameInfo.gameId + "";
+ "" +
+ "#/game/" + data.gameInfo.gameId + "";
let modalBox = document.getElementById("modalInfo");
modalBox.checked = true;
setTimeout(() => { modalBox.checked = false; }, 3000);
@@ -550,20 +550,29 @@ export default {
if (!!opponent)
target = opponent.sid
}
- if (!!target) //opponent is online
- {
- this.st.conn.send(JSON.stringify({code:"newgame",
- gameInfo:gameInfo, target:target, cid:c.id}));
- }
+ const tryNotifyOpponent = () => {
+ if (!!target) //opponent is online
+ {
+ this.st.conn.send(JSON.stringify({code:"newgame",
+ gameInfo:gameInfo, target:target, cid:c.id}));
+ }
+ };
if (c.type == "live")
+ {
+ tryNotifyOpponent();
this.startNewGame(gameInfo);
+ }
else //corr: game only on server
{
ajax(
"/games",
"POST",
{gameInfo: gameInfo, cid: c.id}, //cid useful to delete challenge
- response => { this.$router.push("/game/" + response.gameId); }
+ response => {
+ gameInfo.gameId = response.gameId;
+ tryNotifyOpponent();
+ this.$router.push("/game/" + response.gameId);
+ }
);
}
},
@@ -572,7 +581,7 @@ export default {
const game = Object.assign({}, gameInfo, {
// (other) Game infos: constant
fenStart: gameInfo.fen,
- created: Date.now(),
+ added: Date.now(),
// Game state (including FEN): will be updated
moves: [],
clocks: [-1, -1], //-1 = unstarted