X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fviews%2FMyGames.vue;h=a48c8d4792027cbbb46e298e20e721fe1856adad;hb=5b18515f0b7dbfab8a2770d9b0fc7aace09267dc;hp=890d9395192b57d6b0c342c88af5e8277972a19b;hpb=73f8753ff5abf6c5819684920565e655b6858175;p=vchess.git diff --git a/client/src/views/MyGames.vue b/client/src/views/MyGames.vue index 890d9395..a48c8d47 100644 --- a/client/src/views/MyGames.vue +++ b/client/src/views/MyGames.vue @@ -31,6 +31,7 @@ main v-show="display=='import'" ref="importgames" :games="importGames" + :show-both="true" @show-game="showGame" ) button#loadMoreBtn( @@ -153,12 +154,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 +192,19 @@ 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; + } + // NOTE: since a random new ID is generated for imported games, + // this error will not occur. + else alert(this.st.tr["The game was already imported"]); + } + this.$router.push("/game/" + game.id); + }); }, tryShowNewsIndicator: function(type) { if ( @@ -377,16 +393,13 @@ export default { }; - + + +