errors
This commit is contained in:
parent
a9b92b334f
commit
02c5451c5b
@ -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('/');
|
||||
}
|
||||
if (response.status == 401) {
|
||||
errorMsg.value = "Не верны название команды или пароль"
|
||||
}
|
||||
})
|
||||
.catch(error => {console.error('Ошибка:', error)});
|
||||
.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>
|
||||
|
@ -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