Prepare for CI

This commit is contained in:
2024-05-08 23:42:23 +02:00
parent b1f6e7016a
commit b57b2db2ad
6 changed files with 313 additions and 183 deletions
+16 -3
View File
@@ -1,20 +1,26 @@
<script setup lang="ts">
import { ref } from "vue";
import goStore, { register, setReady, oauth2_register_discord } from "@/netcode";
import { isStaticProperty } from "vue/compiler-sfc";
import goStore, { register, setReady, oauth2_register_discord, setup_websocket } from "@/netcode";
const config = useRuntimeConfig()
await setup_websocket()
const route = useRoute()
let username = ref<string>("legonzaur");
onMounted(() => {
onMounted(async () => {
if (route.path != "/login") {
return
}
const code = route.query.code
if (!code) { return }
if (Array.isArray(code)) { return }
await setup_websocket()
oauth2_register_discord(code)
history.pushState(
@@ -24,6 +30,12 @@ onMounted(() => {
)
})
async function discordLogin() {
await navigateTo(config.public.discordLoginEndpoint, {
external: true
})
}
</script>
<template>
<div id="game_status">
@@ -36,6 +48,7 @@ onMounted(() => {
<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>