added join lobby
This commit is contained in:
@@ -11,6 +11,25 @@
|
|||||||
@click="createGame">
|
@click="createGame">
|
||||||
Create Game
|
Create Game
|
||||||
</v-btn>
|
</v-btn>
|
||||||
|
<v-sheet class="mt-6 d-flex justify-center" color="transparent" height="3.5rem">
|
||||||
|
<v-text-field
|
||||||
|
v-model="lobbyId"
|
||||||
|
placeholder="Lobby ID"
|
||||||
|
rounded
|
||||||
|
style="margin-right: 1rem; height: 3.5rem"
|
||||||
|
variant="outlined"
|
||||||
|
width="9rem" />
|
||||||
|
<v-btn
|
||||||
|
:disabled="!lobbyId"
|
||||||
|
color="yellow"
|
||||||
|
height="3.5rem"
|
||||||
|
rounded
|
||||||
|
variant="tonal"
|
||||||
|
width="10rem"
|
||||||
|
@click="joinGame">
|
||||||
|
Join Game
|
||||||
|
</v-btn>
|
||||||
|
</v-sheet>
|
||||||
</v-sheet>
|
</v-sheet>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -18,13 +37,23 @@
|
|||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
const lobbyId = ref('')
|
||||||
|
|
||||||
const createGame = () => {
|
const createGame = () => {
|
||||||
// Request to Server for new Game Lobby ID
|
// TODO Request to Server for new Game Lobby ID
|
||||||
// This also starts a WebSocket and redirects to /create/[id]
|
// This also starts a WebSocket and redirects to /create/[id]
|
||||||
const id = 0xffffff
|
const id = 0xffffff
|
||||||
router.push(`/create/${id}`)
|
router.push(`/create/${id}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const joinGame = () => {
|
||||||
|
// TODO Check if lobby exists
|
||||||
|
// if exists redirect to lobby
|
||||||
|
// if not, show info
|
||||||
|
if (lobbyId.value) {
|
||||||
|
router.push(`/create/${lobbyId.value}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
Reference in New Issue
Block a user