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 => {
team.value = data
const newActions = team.value?.actions
@ -46,7 +52,6 @@
}
})
.catch(error => {
router.push('/login');
console.error('Ошибка:', error)
});
}

View File

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