|
|
|
|
@ -13,7 +13,6 @@ import isString from 'lodash/isString' |
|
|
|
|
import isBoolean from 'lodash/isBoolean' |
|
|
|
|
|
|
|
|
|
import { PAGES } from 'config' |
|
|
|
|
import { client } from 'config/clients' |
|
|
|
|
|
|
|
|
|
import { |
|
|
|
|
addLanguageUrlParam, |
|
|
|
|
@ -30,7 +29,7 @@ import { queryParamStorage } from 'features/QueryParamsStorage' |
|
|
|
|
import { getUserInfo } from 'requests/getUserInfo' |
|
|
|
|
import { checkDevice, FailedResponse } from 'requests/checkDevice' |
|
|
|
|
|
|
|
|
|
import { getClientSettings } from '../helpers' |
|
|
|
|
import { getClientSettings, noCheckNewDevise } from '../helpers' |
|
|
|
|
|
|
|
|
|
export const useAuth = () => { |
|
|
|
|
const { changeLang, lang } = useLexicsStore() |
|
|
|
|
@ -168,11 +167,14 @@ export const useAuth = () => { |
|
|
|
|
}, [reChekNewDevice, userManager]) |
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
if (client.name !== 'instat') return undefined |
|
|
|
|
if (noCheckNewDevise) return undefined |
|
|
|
|
const startCheckDevice = setInterval(checkNewDevice, 20000) |
|
|
|
|
isNewDeviceLogin && clearInterval(startCheckDevice) |
|
|
|
|
return () => clearInterval(startCheckDevice) |
|
|
|
|
}, [checkNewDevice, isNewDeviceLogin, setIsNewDeviceLogin]) |
|
|
|
|
}, [checkNewDevice, |
|
|
|
|
isNewDeviceLogin, |
|
|
|
|
setIsNewDeviceLogin, |
|
|
|
|
]) |
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
// попытаемся обновить токен используя refresh_token
|
|
|
|
|
|