Web: Client: Settings: move checkWidth

This commit is contained in:
Viktor Fomin 2022-04-13 15:32:15 +03:00
parent b5845e221c
commit 65df8f6bfc
2 changed files with 10 additions and 6 deletions

View File

@ -78,16 +78,18 @@ const PasswordStrength = (props) => {
};
useEffect(() => {
checkWidth();
window.addEventListener("resize", checkWidth);
if (!isInit) initSettings().then(() => setIsLoading(true));
else setIsLoading(true);
return () => window.removeEventListener("resize", checkWidth);
}, []);
useEffect(() => {
if (!isInit) return;
checkWidth();
getSettings();
window.addEventListener("resize", checkWidth);
return () => window.removeEventListener("resize", checkWidth);
}, [isLoading]);
useEffect(() => {

View File

@ -48,16 +48,18 @@ const TwoFactorAuth = (props) => {
};
useEffect(() => {
checkWidth();
window.addEventListener("resize", checkWidth);
if (!isInit) initSettings().then(() => setIsLoading(true));
else setIsLoading(true);
return () => window.removeEventListener("resize", checkWidth);
}, []);
useEffect(() => {
if (!isInit) return;
checkWidth();
getSettings();
window.addEventListener("resize", checkWidth);
return () => window.removeEventListener("resize", checkWidth);
}, [isLoading]);
useEffect(() => {