|
|
|
|
@ -10,8 +10,10 @@ import type { User } from 'oidc-client' |
|
|
|
|
import { UserManager } from 'oidc-client' |
|
|
|
|
|
|
|
|
|
import isString from 'lodash/isString' |
|
|
|
|
import isBoolean from 'lodash/isBoolean' |
|
|
|
|
|
|
|
|
|
import { PAGES } from 'config' |
|
|
|
|
import { client } from 'config/clients' |
|
|
|
|
|
|
|
|
|
import { |
|
|
|
|
addLanguageUrlParam, |
|
|
|
|
@ -149,8 +151,10 @@ export const useAuth = () => { |
|
|
|
|
|
|
|
|
|
checkDevice(loadedUser.access_token).catch((er:FailedResponse) => { |
|
|
|
|
if (er.error) return |
|
|
|
|
setIsNewDeviceLogin(true) |
|
|
|
|
setTimeout(logout, 10000) |
|
|
|
|
if (isBoolean(er.ok) && !er.ok) { |
|
|
|
|
setIsNewDeviceLogin(true) |
|
|
|
|
setTimeout(logout, 10000) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}, [logout, userManager]) |
|
|
|
|
|
|
|
|
|
@ -164,6 +168,7 @@ export const useAuth = () => { |
|
|
|
|
}, [reChekNewDevice, userManager]) |
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
if (client.name !== 'instat') return undefined |
|
|
|
|
const startCheckDevice = setInterval(checkNewDevice, 20000) |
|
|
|
|
isNewDeviceLogin && clearInterval(startCheckDevice) |
|
|
|
|
return () => clearInterval(startCheckDevice) |
|
|
|
|
|