X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fviews%2FGame.vue;h=1675c30bc8072aaa97d4d248caf807a6c5f59dcd;hb=09d375717c256a2cbd71a5d3b3a4e21aee17c0ec;hp=b52de8294fc60fc60757c7a4d485fb6a2f044afa;hpb=3b959cfaf3d3a28373d7ebb48d80087150a98006;p=vchess.git diff --git a/client/src/views/Game.vue b/client/src/views/Game.vue index b52de829..1675c30b 100644 --- a/client/src/views/Game.vue +++ b/client/src/views/Game.vue @@ -70,6 +70,7 @@ import Chat from "@/components/Chat.vue"; import { store } from "@/store"; import { GameStorage } from "@/utils/gameStorage"; import { ppt } from "@/utils/datetime"; +import { ajax } from "@/utils/ajax"; import { extractTime } from "@/utils/timeControl"; import { getRandString } from "@/utils/alea"; import { processModalClick } from "@/utils/modalClick"; @@ -206,16 +207,11 @@ export default { }, clearChat: function() { // Nothing more to do if game is live (chats not recorded) - if (this.game.mycolor && this.game.type == "corr") { - ajax( - "/chats", - "DELETE", - {gid: this.game.id}, - () => { - // TODO: this.game.pastChats = [] could be enough here? - this.$set(this.game, "pastChats", []); - } - ); + if (this.game.type == "corr") { + if (this.game.mycolor) + ajax("/chats", "DELETE", {gid: this.game.id}); + // TODO: this.game.chats = [] could be enough here? + this.$set(this.game, "chats", []); } }, socketMessageListener: function(msg) { @@ -252,12 +248,12 @@ export default { break; case "killed": // I logged in elsewhere: - alert(this.st.tr["New connexion detected: tab now offline"]); // TODO: this fails. See https://github.com/websockets/ws/issues/489 //this.conn.removeEventListener("message", this.socketMessageListener); //this.conn.removeEventListener("close", this.socketCloseListener); //this.conn.close(); this.conn = null; + alert(this.st.tr["New connexion detected: tab now offline"]); break; case "askidentity": { // Request for identification (TODO: anonymous shouldn't need to reply)