From ffbca0cf2f80b54f454af2b1642caa444857453a Mon Sep 17 00:00:00 2001 From: "andrey.dekterev" Date: Wed, 22 Feb 2023 12:32:08 +0000 Subject: [PATCH] revert eb4a368ad12c90944915d971d82ac9aa25cc3289 revert Revert "fix(#274): off check new device option" This reverts commit 6dad0f375840d17ddb206a3c8879ebd576deb959. --- src/features/AuthStore/hooks/useAuth.tsx | 26 +++++++++++++----------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/features/AuthStore/hooks/useAuth.tsx b/src/features/AuthStore/hooks/useAuth.tsx index aa91df65..4d0a4542 100644 --- a/src/features/AuthStore/hooks/useAuth.tsx +++ b/src/features/AuthStore/hooks/useAuth.tsx @@ -36,6 +36,7 @@ import { queryParamStorage } from 'features/QueryParamsStorage' import { getUserInfo, UserInfo } from 'requests/getUserInfo' import { checkDevice, FailedResponse } from 'requests/checkDevice' +// eslint-disable-next-line import { getClientSettings, needCheckNewDeviсe } from '../helpers' import { getTokenVirtualUser } from '../../../requests' @@ -179,6 +180,7 @@ export const useAuth = () => { }) }, [logout, userManager]) + // eslint-disable-next-line const checkNewDevice = useCallback(async () => { const loadedUser = await userManager.getUser() if (!loadedUser) return @@ -188,18 +190,18 @@ export const useAuth = () => { }) }, [reChekNewDevice, userManager]) - useEffect(() => { - if (!needCheckNewDeviсe && !user) return undefined - const startCheckDevice = setInterval(checkNewDevice, 20000) - isNewDeviceLogin && clearInterval(startCheckDevice) - return () => clearInterval(startCheckDevice) - - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [ - checkNewDevice, - isNewDeviceLogin, - setIsNewDeviceLogin, - ]) + // useEffect(() => { + // if (!needCheckNewDeviсe && !user) return undefined + // const startCheckDevice = setInterval(checkNewDevice, 20000) + // isNewDeviceLogin && clearInterval(startCheckDevice) + // return () => clearInterval(startCheckDevice) + // + // // eslint-disable-next-line react-hooks/exhaustive-deps + // }, [ + // checkNewDevice, + // isNewDeviceLogin, + // setIsNewDeviceLogin, + // ]) useEffect(() => { // попытаемся обновить токен используя refresh_token