forked from noxious/client
npm run format
This commit is contained in:
@ -6,11 +6,11 @@
|
||||
<form method="post">
|
||||
<div class="form-field">
|
||||
<label for="username">Username</label>
|
||||
<input id="username" 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 id="password" v-model="password" type="password" name="password" required>
|
||||
<input id="password" v-model="password" type="password" name="password" required />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@ -28,10 +28,10 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { useSocketStore } from '@/stores/socket.ts'
|
||||
import {login, register} from '@/services/authentication.ts'
|
||||
import { login, register } from '@/services/authentication.ts'
|
||||
import { useNotificationStore } from '@/stores/notifications'
|
||||
|
||||
const bgm = ref('bgm');
|
||||
const bgm = ref('bgm')
|
||||
if (bgm.value.paused) {
|
||||
window.addEventListener('click', () => bgm.value.play())
|
||||
window.addEventListener('keydown', () => bgm.value.play())
|
||||
@ -39,22 +39,22 @@ if (bgm.value.paused) {
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const notifications = useNotificationStore()
|
||||
const socket = useSocketStore();
|
||||
const username = ref('');
|
||||
const password = ref('');
|
||||
const socket = useSocketStore()
|
||||
const username = ref('')
|
||||
const password = ref('')
|
||||
|
||||
async function loginFunc() {
|
||||
// check if username and password are valid
|
||||
if (username.value === '' || password.value === '') {
|
||||
notifications.addNotification({ message: 'Please enter a valid username and password' });
|
||||
return;
|
||||
notifications.addNotification({ message: 'Please enter a valid username and password' })
|
||||
return
|
||||
}
|
||||
|
||||
// send login event to server
|
||||
const success = await login(username.value, password.value);
|
||||
const success = await login(username.value, password.value)
|
||||
|
||||
if (!success) {
|
||||
notifications.addNotification({ message: 'Invalid username or password' });
|
||||
notifications.addNotification({ message: 'Invalid username or password' })
|
||||
}
|
||||
|
||||
// if (success) {}
|
||||
@ -63,15 +63,15 @@ async function loginFunc() {
|
||||
async function registerFunc() {
|
||||
// check if username and password are valid
|
||||
if (username.value === '' || password.value === '') {
|
||||
notifications.addNotification({ message: 'Please enter a valid username and password' });
|
||||
return;
|
||||
notifications.addNotification({ message: 'Please enter a valid username and password' })
|
||||
return
|
||||
}
|
||||
|
||||
// send register event to server
|
||||
const success = await register(username.value, password.value);
|
||||
const success = await register(username.value, password.value)
|
||||
|
||||
if (!success) {
|
||||
notifications.addNotification({ message: 'Username already exists' });
|
||||
notifications.addNotification({ message: 'Username already exists' })
|
||||
}
|
||||
|
||||
// if (success) {}
|
||||
@ -79,5 +79,5 @@ async function registerFunc() {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import "@/assets/scss/login";
|
||||
</style>
|
||||
@import '@/assets/scss/login';
|
||||
</style>
|
||||
|
Reference in New Issue
Block a user