forked from noxious/client
Worked on commands, notifications
This commit is contained in:
@ -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) {}
|
||||
|
Reference in New Issue
Block a user