X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fviews%2FMyGames.vue;fp=client%2Fsrc%2Fviews%2FMyGames.vue;h=52e6dc3beb9041beca07ec60f7fb84c4dbe47fbf;hb=1ef65040168ab7d55ce921abc9d63644a937d689;hp=890d9395192b57d6b0c342c88af5e8277972a19b;hpb=73f8753ff5abf6c5819684920565e655b6858175;p=vchess.git diff --git a/client/src/views/MyGames.vue b/client/src/views/MyGames.vue index 890d9395..52e6dc3b 100644 --- a/client/src/views/MyGames.vue +++ b/client/src/views/MyGames.vue @@ -153,12 +153,19 @@ export default { // Now ask completed games (partial list) this.loadMore( "live", - () => this.loadMore("corr", adjustAndSetDisplay) + () => this.loadMore("corr", () => { + this.loadMore("import", adjustAndSetDisplay); + }) ); } } ); - } else this.loadMore("live", adjustAndSetDisplay); + } + else { + this.loadMore("live", () => { + this.loadMore("import", adjustAndSetDisplay); + }); + } }); }, beforeDestroy: function() { @@ -184,11 +191,17 @@ export default { } }, addGameImport(game) { - if (!game.id) { - alert(this.st.tr[ - "No identifier found: use the upload button in analysis mode"]); - } - else this.importGames.push(game); + game.type = "import"; + ImportgameStorage.add(game, (err) => { + if (!!err) { + if (err.message.indexOf("Key already exists") < 0) { + alert(this.st.tr["An error occurred. Try again!"]); + return; + } + else alert(this.st.tr["The game was already imported"]); + } + this.$router.push("/game/" + game.id); + }); }, tryShowNewsIndicator: function(type) { if (