Add error when game code is empty

This commit is contained in:
Tim 2021-07-06 18:03:06 +02:00
parent 9fbdd98bc6
commit 8532c5750f

View File

@ -31,7 +31,7 @@
The game has started, lets go! The game has started, lets go!
</template> </template>
<HelloWorld msg="Welcome to Your Vue.js + TypeScript App"/> <HelloWorld msg="Welcome to Your Vue.js + TypeScript App" />
</div> </div>
</template> </template>
@ -77,6 +77,10 @@ export default class Home extends Vue {
} }
private joinGame() { private joinGame() {
if (this.code === '') {
this.error = "Game code cannot be empty when joining a game";
return;
}
PerudoApi.instance.joinGame(this.name, this.code).then((response: JoinCreateGameObject) => { PerudoApi.instance.joinGame(this.name, this.code).then((response: JoinCreateGameObject) => {
this.playerId = response.player.id; this.playerId = response.player.id;