errors
This commit is contained in:
parent
a9b92b334f
commit
02c5451c5b
@ -6,8 +6,13 @@
|
|||||||
|
|
||||||
const login = ref("")
|
const login = ref("")
|
||||||
const password = ref("")
|
const password = ref("")
|
||||||
|
const buttonText = ref("Вход")
|
||||||
|
const errorMsg = ref("")
|
||||||
|
|
||||||
function onClickLogin() {
|
function onClickLogin() {
|
||||||
|
const oldText = buttonText.value
|
||||||
|
buttonText.value = "Загрузка..."
|
||||||
|
errorMsg.value = ""
|
||||||
fetch(
|
fetch(
|
||||||
host+"/team",
|
host+"/team",
|
||||||
{
|
{
|
||||||
@ -24,11 +29,15 @@
|
|||||||
sessionStorage.setItem("password", password.value)
|
sessionStorage.setItem("password", password.value)
|
||||||
router.push('/');
|
router.push('/');
|
||||||
}
|
}
|
||||||
|
if (response.status == 401) {
|
||||||
|
errorMsg.value = "Не верны название команды или пароль"
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch(error => {console.error('Ошибка:', error)});
|
.catch(() => {
|
||||||
|
errorMsg.value = "Сервер не доступен " + host
|
||||||
|
})
|
||||||
|
.finally(() => {buttonText.value = oldText});
|
||||||
}
|
}
|
||||||
|
|
||||||
onClickLogin()
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -45,12 +54,18 @@
|
|||||||
<input class="input-custom" v-model="password" type="text" placeholder="Пароль" autocapitalize="off">
|
<input class="input-custom" v-model="password" type="text" placeholder="Пароль" autocapitalize="off">
|
||||||
</div>
|
</div>
|
||||||
<div class="button-container">
|
<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>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.error-message {
|
||||||
|
color: brown;
|
||||||
|
margin: 16px 0;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -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"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user