Redukce zbytečných pokusů o příhlášení

This commit is contained in:
Martin Berka 2023-09-06 19:19:13 +02:00
parent 700a6980ca
commit 5379c21203

View File

@ -12,6 +12,7 @@ export default function Login() {
const loginRef = useRef<HTMLInputElement>(null);
useEffect(() => {
if (auth && !auth.login) {
// Vyzkoušíme přihlášení "naprázdno", pokud projde, přihlásili nás trusted headers
login().then(token => {
if (token) {
@ -20,7 +21,8 @@ export default function Login() {
}).catch(error => {
// nezajímá nás
});
}, []);
}
}, [auth]);
const doLogin = useCallback(async () => {
const length = loginRef?.current?.value && loginRef?.current?.value.length && loginRef.current.value.replace(/\s/g, '').length