feat: 🎸 ott-2739-block-checkDevice

fix pr
keep-around/b214ac7012ef42593bee62c207888a2593bc5a38
Zoia R 3 years ago committed by Gitea
parent 2ade845aa7
commit 03110eb825
  1. 6
      src/features/AuthStore/helpers.tsx
  2. 4
      src/features/AuthStore/hooks/useAuth.tsx

@ -1,8 +1,6 @@
import type { UserManagerSettings } from 'oidc-client' import type { UserManagerSettings } from 'oidc-client'
import { WebStorageStateStore } from 'oidc-client' import { WebStorageStateStore } from 'oidc-client'
import includes from 'lodash/includes'
import { client } from 'config/clients' import { client } from 'config/clients'
import { AUTH_SERVICE } from 'config/routes' import { AUTH_SERVICE } from 'config/routes'
import { ClientIds, ClientNames } from 'config/clients/types' import { ClientIds, ClientNames } from 'config/clients/types'
@ -59,6 +57,4 @@ export const getClientSettings = (): Settings => ({
userStore: new WebStorageStateStore({ store: window.localStorage }), userStore: new WebStorageStateStore({ store: window.localStorage }),
}) })
const disableCheckNewDeviceClients = ['lff', 'facr'] export const needCheckNewDeviсe = client.name === 'instat' || client.name === 'insports'
export const noCheckNewDevise = includes(disableCheckNewDeviceClients, client.name)

@ -29,7 +29,7 @@ import { queryParamStorage } from 'features/QueryParamsStorage'
import { getUserInfo } from 'requests/getUserInfo' import { getUserInfo } from 'requests/getUserInfo'
import { checkDevice, FailedResponse } from 'requests/checkDevice' import { checkDevice, FailedResponse } from 'requests/checkDevice'
import { getClientSettings, noCheckNewDevise } from '../helpers' import { getClientSettings, needCheckNewDeviсe } from '../helpers'
export const useAuth = () => { export const useAuth = () => {
const { changeLang, lang } = useLexicsStore() const { changeLang, lang } = useLexicsStore()
@ -167,7 +167,7 @@ export const useAuth = () => {
}, [reChekNewDevice, userManager]) }, [reChekNewDevice, userManager])
useEffect(() => { useEffect(() => {
if (noCheckNewDevise) return undefined if (!needCheckNewDeviсe) return undefined
const startCheckDevice = setInterval(checkNewDevice, 20000) const startCheckDevice = setInterval(checkNewDevice, 20000)
isNewDeviceLogin && clearInterval(startCheckDevice) isNewDeviceLogin && clearInterval(startCheckDevice)
return () => clearInterval(startCheckDevice) return () => clearInterval(startCheckDevice)

Loading…
Cancel
Save