diff --git a/web/src/views/CreateJoin.vue b/web/src/views/CreateJoin.vue index 3c27289..95da088 100644 --- a/web/src/views/CreateJoin.vue +++ b/web/src/views/CreateJoin.vue @@ -64,7 +64,10 @@ export default { return; }; + history.replaceState(null, ``, `?game=${data.game_code}`); + // Save the data in the store + this.$store.commit(`playerList`, data.players); this.$store.commit(`game_code`, this.game_code); this.$store.commit(`player`, { name: this.name, @@ -79,7 +82,10 @@ export default { return; }; + history.replaceState(null, ``, `?game=${data.game_code}`); + // Update storage + this.$store.commit(`playerList`, data.players); this.$store.commit(`game_code`, data.game_code); this.$store.commit(`player`, { name: this.name, diff --git a/web/src/views/Lobby.vue b/web/src/views/Lobby.vue index 6a4f975..1891a11 100644 --- a/web/src/views/Lobby.vue +++ b/web/src/views/Lobby.vue @@ -4,20 +4,22 @@
- +
@@ -41,12 +43,29 @@ export default { "RoleSelect": TeamRoleSelect, "PlayerList": PlayerList, }, + data() {return { + copyURLButtonText: `Click to Copy Game Link`, + }}, computed: { playerName() { return this.$store.state.name; + }, + gameURL() { + return `${window.location.protocol}//${window.location.host}?game=${this.$store.state.game_code}`; + } + }, + methods: { + copySuccess() { + this.copyURLButtonText = `Game Link Copied!`; + setTimeout(() => { this.copyURLButtonText = `Click to Copy Game Link`; }, 1000) + }, + copyError(e) { + this.$emit(`error`, { + status: 418, + message: `Failed to copy game URL`, + }); } }, - methods: {}, } @@ -55,7 +74,6 @@ export default { @import "../css/style.css"; #GameLobby { - justify-content: center; flex-direction: column; align-items: stretch; display: flex;