forked from noxious/client
yuhhh
This commit is contained in:
@ -26,7 +26,7 @@
|
||||
import { useSocketStore } from '@/stores/socket'
|
||||
|
||||
const socket = useSocketStore();
|
||||
socket.getSocket.emit('characters:get');
|
||||
socket.connection.emit('characters:get');
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
@ -1,41 +1,35 @@
|
||||
<template>
|
||||
<audio ref="bgm" id="bgm" src="/assets/music/bgm.mp3" loop autoplay></audio>
|
||||
<img src="/assets/bglogin.png" id="bg-img" alt="New Quest login background" />
|
||||
<div class="content-wrapper">
|
||||
<h1 class="main-title">NEW QUEST</h1>
|
||||
|
||||
<div class="content-elements">
|
||||
<div class="login-form">
|
||||
<form method="post">
|
||||
<div class="form-field">
|
||||
<label for="username">Username</label>
|
||||
<input v-model="username" type="text" name="username" required autofocus>
|
||||
<input id="username" v-model="username" type="text" name="username" required autofocus>
|
||||
</div>
|
||||
<div class="form-field">
|
||||
<label for="password">Password</label>
|
||||
<input v-model="password" type="password" name="password" required>
|
||||
<input id="password" v-model="password" type="password" name="password" required>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="row-buttons">
|
||||
<button class="button" @click="loginFunc">
|
||||
<span>LOGIN</span>
|
||||
</button>
|
||||
<button class="button" @click="registerFunc">
|
||||
<span>REGISTER</span>
|
||||
</button>
|
||||
<button class="button">
|
||||
<span>CREDITS</span>
|
||||
</button>
|
||||
<button class="button" @click="loginFunc"><span>LOGIN</span></button>
|
||||
<button class="button" @click="registerFunc"><span>REGISTER</span></button>
|
||||
<button class="button"><span>CREDITS</span></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<audio ref="bgm" id="bgm" src="/assets/music/bgm.mp3" loop autoplay></audio>
|
||||
<img src="/assets/bglogin.png" id="bg-img" alt="New Quest login background" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { useSocketStore } from '@/stores/socket.ts'
|
||||
import {login, register} from '@/services/authService'
|
||||
import { useCookies } from '@vueuse/integrations/useCookies'
|
||||
|
||||
const bgm = ref('bgm');
|
||||
if (bgm.value.paused) {
|
||||
@ -43,6 +37,7 @@ if (bgm.value.paused) {
|
||||
window.addEventListener('keydown', () => bgm.value.play())
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const socket = useSocketStore();
|
||||
const username = ref('');
|
||||
const password = ref('');
|
||||
@ -54,11 +49,14 @@ async function loginFunc() {
|
||||
return;
|
||||
}
|
||||
|
||||
// send register event to server
|
||||
// send login event to server
|
||||
const success = await login(username.value, password.value);
|
||||
|
||||
if (!success) {
|
||||
alert('Invalid username or password');
|
||||
}
|
||||
|
||||
// if (success) {}
|
||||
}
|
||||
|
||||
async function registerFunc() {
|
||||
@ -75,9 +73,7 @@ async function registerFunc() {
|
||||
alert('Username already exists');
|
||||
}
|
||||
|
||||
if (success) {
|
||||
alert('User registered successfully, you can now log in!');
|
||||
}
|
||||
// if (success) {}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
Reference in New Issue
Block a user