From e4bced0c027e28a34d5722e13f99e7c17a93b0c9 Mon Sep 17 00:00:00 2001 From: vikingowl Date: Sun, 10 Nov 2024 20:26:33 +0100 Subject: [PATCH] added join lobby --- src/pages/index.vue | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/src/pages/index.vue b/src/pages/index.vue index 70a2e1c..7b28590 100644 --- a/src/pages/index.vue +++ b/src/pages/index.vue @@ -11,6 +11,25 @@ @click="createGame"> Create Game + + + + Join Game + + @@ -18,13 +37,23 @@ import { useRouter } from 'vue-router' const router = useRouter() +const lobbyId = ref('') 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] const id = 0xffffff 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}`) + } +}