1
0
forked from noxious/client

Worked on commands, notifications

This commit is contained in:
2024-06-01 19:36:27 +02:00
parent b58df15ae0
commit ef12c61ea9
16 changed files with 136 additions and 76 deletions

View File

@ -25,11 +25,11 @@
<img src="/assets/bglogin.png" id="bg-img" alt="New Quest login background" />
</template>
<script setup>
import { onMounted, ref } from 'vue'
<script setup lang="ts">
import { ref } from 'vue'
import { useSocketStore } from '@/stores/socket.ts'
import {login, register} from '@/services/authentication.ts'
import { useCookies } from '@vueuse/integrations/useCookies'
import { useNotificationStore } from '@/stores/notifications'
const bgm = ref('bgm');
if (bgm.value.paused) {
@ -38,6 +38,7 @@ 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('');
@ -45,7 +46,7 @@ const password = ref('');
async function loginFunc() {
// check if username and password are valid
if (username.value === '' || password.value === '') {
alert('Please enter a valid username and password');
notifications.addNotification({ message: 'Please enter a valid username and password' });
return;
}
@ -53,7 +54,7 @@ async function loginFunc() {
const success = await login(username.value, password.value);
if (!success) {
alert('Invalid username or password');
notifications.addNotification({ message: 'Invalid username or password' });
}
// if (success) {}
@ -62,7 +63,7 @@ async function loginFunc() {
async function registerFunc() {
// check if username and password are valid
if (username.value === '' || password.value === '') {
alert('Please enter a valid username and password');
notifications.addNotification({ message: 'Please enter a valid username and password' });
return;
}
@ -70,7 +71,7 @@ async function registerFunc() {
const success = await register(username.value, password.value);
if (!success) {
alert('Username already exists');
notifications.addNotification({ message: 'Username already exists' });
}
// if (success) {}