This commit is contained in:
@@ -1,18 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
|
||||
import goStore, { register, setReady, oauth2_register_discord, setup_websocket } from "@/netcode";
|
||||
|
||||
|
||||
|
||||
const config = useRuntimeConfig()
|
||||
import goStore, { setReady, oauth2_register_discord, setup_websocket } from "@/netcode";
|
||||
|
||||
await setup_websocket()
|
||||
|
||||
const route = useRoute()
|
||||
|
||||
let username = ref<string>("legonzaur");
|
||||
|
||||
onMounted(async () => {
|
||||
const code = route.query.code
|
||||
if (!code) { return }
|
||||
@@ -26,37 +19,20 @@ onMounted(async () => {
|
||||
)
|
||||
})
|
||||
|
||||
async function discordLogin() {
|
||||
await navigateTo(config.public.discordLoginEndpoint, {
|
||||
external: true
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
<template>
|
||||
<div id="game_status">
|
||||
<template v-if="!goStore.self">
|
||||
|
||||
<div v-if="goStore.game?.started">
|
||||
<b>SPECTATOR MODE</b>
|
||||
</div>
|
||||
|
||||
<template v-if="!goStore.game?.started">
|
||||
<input type="text" v-model="username" />
|
||||
<button @click="register(username)">LOGIN</button>
|
||||
<button @click="discordLogin()">DISCORD</button>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
|
||||
<template v-if="goStore.self && !goStore.game?.started">
|
||||
<template v-if="goStore.self && !goStore.current_game?.started">
|
||||
<input @change="setReady(($event.target as HTMLInputElement).checked)" type="checkbox" id="ready" />
|
||||
<label for="ready">Ready</label>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<GameBoard></GameBoard>
|
||||
|
||||
<LoginView v-if="goStore.context === 'login'"></LoginView>
|
||||
<GameBoard v-if="goStore.context != 'lobby' && goStore.context != 'login'"></GameBoard>
|
||||
<LobbyView v-if="goStore.context == 'lobby'"></LobbyView>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
|
||||
Reference in New Issue
Block a user