Revert "fix(#274): off check new device option"

This reverts commit 6dad0f3758.
pull/84/head
Andrei Dekterev 3 years ago
parent 62281019f1
commit eb4a368ad1
  1. 26
      src/features/AuthStore/hooks/useAuth.tsx

@ -36,7 +36,6 @@ 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'
@ -180,7 +179,6 @@ export const useAuth = () => {
})
}, [logout, userManager])
// eslint-disable-next-line
const checkNewDevice = useCallback(async () => {
const loadedUser = await userManager.getUser()
if (!loadedUser) return
@ -190,18 +188,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

Loading…
Cancel
Save