This commit is contained in:
Владимир Фёдоров 2025-05-18 22:13:25 +07:00
parent a9b92b334f
commit 02c5451c5b
2 changed files with 22 additions and 6 deletions

View File

@ -6,8 +6,13 @@
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",
{
@ -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 = "Сервер не доступен " + host
})
.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 +1,2 @@
export const host = "http://192.168.0.110:8090"
export const host = "http://0.0.0.0:8090"
// export const host = "http://192.168.0.110:8090"