haha keyboard go brrr

This commit is contained in:
2024-05-16 00:26:25 +02:00
parent 2638d6024f
commit 1ed0283a94
8 changed files with 154 additions and 153 deletions

View File

@ -1,30 +1,28 @@
<template>
<Login v-if="screen === 'login'" />
<!-- <Register v-if="screen === 'register'" />-->
<CharacterSelection v-if="screen === 'character_selection'" />
<Register v-if="screen === 'register'" />
<Game v-if="screen === 'game'" />
</template>
<script setup lang="ts">
import Game from '@/components/Game.vue'
import Login from '@/components/screens/Login.vue'
import { onMounted, onUnmounted, type Ref, ref, watch } from 'vue'
import Register from '@/components/screens/Register.vue'
import { type Ref, ref } from 'vue'
import { useSocketStore } from '@/stores/socket'
import { storeToRefs } from 'pinia'
import CharacterSelection from '@/components/screens/CharacterSelection.vue'
const screen:Ref<string> = ref('login');
const socket = useSocketStore();
onMounted(() => {
// SocketioService.setupSocketConnection();
});
const { isAuthenticated } = storeToRefs(socket);
watch(isAuthenticated, (isAuthenticated) => {
if (isAuthenticated) {
screen.value = 'game';
} else {
screen.value = 'login';
socket.$subscribe((mutation, state) => {
if (state.isAuthenticated) {
screen.value = 'character_selection';
}
});
if (state.character) {
screen.value = 'game';
}
}, { detached: true })
</script>