From 5379c21203caca5d4c66a8daad66b810ce43761c Mon Sep 17 00:00:00 2001 From: Martin Berka Date: Wed, 6 Sep 2023 19:19:13 +0200 Subject: [PATCH] =?UTF-8?q?Redukce=20zbyte=C4=8Dn=C3=BDch=20pokus=C5=AF=20?= =?UTF-8?q?o=20p=C5=99=C3=ADhl=C3=A1=C5=A1en=C3=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/Login.tsx | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/client/src/Login.tsx b/client/src/Login.tsx index f4a52f1..d1556e6 100644 --- a/client/src/Login.tsx +++ b/client/src/Login.tsx @@ -12,15 +12,17 @@ export default function Login() { const loginRef = useRef(null); useEffect(() => { - // Vyzkoušíme přihlášení "naprázdno", pokud projde, přihlásili nás trusted headers - login().then(token => { - if (token) { - auth?.setToken(token); - } - }).catch(error => { - // nezajímá nás - }); - }, []); + 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) { + auth?.setToken(token); + } + }).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