From 03110eb825c0289c288ca4df0214a22c9bd395cb Mon Sep 17 00:00:00 2001 From: Zoia R Date: Tue, 6 Sep 2022 19:34:26 +0300 Subject: [PATCH] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20ott-2739-block-checkDevi?= =?UTF-8?q?ce?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix pr --- src/features/AuthStore/helpers.tsx | 6 +----- src/features/AuthStore/hooks/useAuth.tsx | 4 ++-- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/features/AuthStore/helpers.tsx b/src/features/AuthStore/helpers.tsx index 60e9908c..356607e9 100644 --- a/src/features/AuthStore/helpers.tsx +++ b/src/features/AuthStore/helpers.tsx @@ -1,8 +1,6 @@ import type { UserManagerSettings } from 'oidc-client' import { WebStorageStateStore } from 'oidc-client' -import includes from 'lodash/includes' - import { client } from 'config/clients' import { AUTH_SERVICE } from 'config/routes' import { ClientIds, ClientNames } from 'config/clients/types' @@ -59,6 +57,4 @@ export const getClientSettings = (): Settings => ({ userStore: new WebStorageStateStore({ store: window.localStorage }), }) -const disableCheckNewDeviceClients = ['lff', 'facr'] - -export const noCheckNewDevise = includes(disableCheckNewDeviceClients, client.name) +export const needCheckNewDeviсe = client.name === 'instat' || client.name === 'insports' diff --git a/src/features/AuthStore/hooks/useAuth.tsx b/src/features/AuthStore/hooks/useAuth.tsx index 45e8a76e..b4a4b176 100644 --- a/src/features/AuthStore/hooks/useAuth.tsx +++ b/src/features/AuthStore/hooks/useAuth.tsx @@ -29,7 +29,7 @@ import { queryParamStorage } from 'features/QueryParamsStorage' import { getUserInfo } from 'requests/getUserInfo' import { checkDevice, FailedResponse } from 'requests/checkDevice' -import { getClientSettings, noCheckNewDevise } from '../helpers' +import { getClientSettings, needCheckNewDeviсe } from '../helpers' export const useAuth = () => { const { changeLang, lang } = useLexicsStore() @@ -167,7 +167,7 @@ export const useAuth = () => { }, [reChekNewDevice, userManager]) useEffect(() => { - if (noCheckNewDevise) return undefined + if (!needCheckNewDeviсe) return undefined const startCheckDevice = setInterval(checkNewDevice, 20000) isNewDeviceLogin && clearInterval(startCheckDevice) return () => clearInterval(startCheckDevice)