This commit is contained in:
Владимир Фёдоров 2025-05-19 02:35:35 +07:00
parent e97a318237
commit bc88340480
2 changed files with 16 additions and 5 deletions

View File

@ -37,7 +37,13 @@
}, },
} }
) )
.then(response => response.json()) .then(response => {
if (response.status == 401) {
router.push('/login');
return
}
return response.json()
})
.then(data => { .then(data => {
team.value = data team.value = data
const newActions = team.value?.actions const newActions = team.value?.actions
@ -46,7 +52,6 @@
} }
}) })
.catch(error => { .catch(error => {
router.push('/login');
console.error('Ошибка:', error) console.error('Ошибка:', error)
}); });
} }

View File

@ -1,12 +1,12 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue'; import { onMounted, ref } from 'vue';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { getApiUrl } from './net'; import { getApiUrl } from './net';
const router = useRouter(); const router = useRouter();
const login = ref("") const login = ref(sessionStorage.getItem("teamId") || "")
const password = ref("") const password = ref(sessionStorage.getItem("password") || "")
const buttonText = ref("Вход") const buttonText = ref("Вход")
const errorMsg = ref("") const errorMsg = ref("")
@ -32,6 +32,9 @@
return return
} }
if (response.status == 401) { if (response.status == 401) {
if (login.value == "" && password.value == "") {
return
}
errorMsg.value = "Не верны название команды или пароль" errorMsg.value = "Не верны название команды или пароль"
return return
} }
@ -42,6 +45,9 @@
}) })
.finally(() => {buttonText.value = oldText}); .finally(() => {buttonText.value = oldText});
} }
onMounted(() => {
onClickLogin()
})
</script> </script>
<template> <template>