Compare commits

...

2 Commits

Author SHA1 Message Date
75c11b36a6 rm net 2025-05-18 22:59:20 +07:00
02c5451c5b errors 2025-05-18 22:13:25 +07:00
3 changed files with 36 additions and 20 deletions

View File

@ -1,7 +1,6 @@
<script setup lang="ts">
import { ref, nextTick, watch, onMounted } from 'vue';
import { useRouter } from 'vue-router';
import { host } from './net';
const router = useRouter();
@ -28,7 +27,7 @@
function getTeam() {
fetch(
host+"/team",
"/team",
{
method: "GET",
headers: {
@ -52,7 +51,9 @@
}
function addAction() {
fetch(host+"/team/actions", {
fetch(
"/team/actions",
{
method: "POST",
headers: {
"X-Id": sessionStorage.getItem("teamId") || "",
@ -61,7 +62,8 @@
body: JSON.stringify({
"place": place.value
})
})
}
)
.then(async () => {place.value = ""})
}

View File

@ -1,15 +1,20 @@
<script setup lang="ts">
import { ref } from 'vue';
import { useRouter } from 'vue-router';
import { host } from './net';
const router = useRouter();
const login = ref("")
const password = ref("")
const buttonText = ref("Вход")
const errorMsg = ref("")
function onClickLogin() {
const oldText = buttonText.value
buttonText.value = "Загрузка..."
errorMsg.value = ""
fetch(
host+"/team",
"/team",
{
method: "GET",
headers: {
@ -24,11 +29,15 @@
sessionStorage.setItem("password", password.value)
router.push('/');
}
})
.catch(error => {console.error('Ошибка:', error)});
if (response.status == 401) {
errorMsg.value = "Не верны название команды или пароль"
}
})
.catch(() => {
errorMsg.value = "Сервер не доступен"
})
.finally(() => {buttonText.value = oldText});
}
onClickLogin()
</script>
<template>
@ -45,12 +54,18 @@
<input class="input-custom" v-model="password" type="text" placeholder="Пароль" autocapitalize="off">
</div>
<div class="button-container">
<button class="button-custom" type="submit">Вход</button>
<button class="button-custom" type="submit">{{ buttonText }}</button>
</div>
<div class="error-message">
{{ errorMsg }}
</div>
</form>
</div>
</template>
<style scoped>
.error-message {
color: brown;
margin: 16px 0;
}
</style>

View File

@ -1 +0,0 @@
export const host = "http://192.168.0.110:8090"