Compare commits
No commits in common. "75c11b36a602a2a6940a7eda1fd0ea216883ceed" and "a9b92b334fc31fda73812041cfe1e3843cf844b1" have entirely different histories.
75c11b36a6
...
a9b92b334f
@ -1,6 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, nextTick, watch, onMounted } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { host } from './net';
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
@ -27,7 +28,7 @@
|
||||
|
||||
function getTeam() {
|
||||
fetch(
|
||||
"/team",
|
||||
host+"/team",
|
||||
{
|
||||
method: "GET",
|
||||
headers: {
|
||||
@ -51,9 +52,7 @@
|
||||
}
|
||||
|
||||
function addAction() {
|
||||
fetch(
|
||||
"/team/actions",
|
||||
{
|
||||
fetch(host+"/team/actions", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"X-Id": sessionStorage.getItem("teamId") || "",
|
||||
@ -62,8 +61,7 @@
|
||||
body: JSON.stringify({
|
||||
"place": place.value
|
||||
})
|
||||
}
|
||||
)
|
||||
})
|
||||
.then(async () => {place.value = ""})
|
||||
}
|
||||
|
||||
|
@ -1,20 +1,15 @@
|
||||
<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(
|
||||
"/team",
|
||||
host+"/team",
|
||||
{
|
||||
method: "GET",
|
||||
headers: {
|
||||
@ -29,15 +24,11 @@
|
||||
sessionStorage.setItem("password", password.value)
|
||||
router.push('/');
|
||||
}
|
||||
if (response.status == 401) {
|
||||
errorMsg.value = "Не верны название команды или пароль"
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
errorMsg.value = "Сервер не доступен"
|
||||
})
|
||||
.finally(() => {buttonText.value = oldText});
|
||||
.catch(error => {console.error('Ошибка:', error)});
|
||||
}
|
||||
|
||||
onClickLogin()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@ -54,18 +45,12 @@
|
||||
<input class="input-custom" v-model="password" type="text" placeholder="Пароль" autocapitalize="off">
|
||||
</div>
|
||||
<div class="button-container">
|
||||
<button class="button-custom" type="submit">{{ buttonText }}</button>
|
||||
</div>
|
||||
<div class="error-message">
|
||||
{{ errorMsg }}
|
||||
<button class="button-custom" type="submit">Вход</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.error-message {
|
||||
color: brown;
|
||||
margin: 16px 0;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
1
src/components/net.ts
Normal file
1
src/components/net.ts
Normal file
@ -0,0 +1 @@
|
||||
export const host = "http://192.168.0.110:8090"
|
Loading…
x
Reference in New Issue
Block a user