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