From 2a3fd8f3ad3b97d12c627414ecb2e07c38b9f8dd Mon Sep 17 00:00:00 2001 From: Rakov Roman Date: Thu, 7 Jul 2022 15:26:18 +0300 Subject: [PATCH] fix(#2531): fixed white authorization screen --- .../AuthServiceApp/hooks/useParamsUrl.tsx | 16 ++++++++++++++-- tsconfig.json | 3 ++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/features/AuthServiceApp/hooks/useParamsUrl.tsx b/src/features/AuthServiceApp/hooks/useParamsUrl.tsx index 165ea767..b083db57 100644 --- a/src/features/AuthServiceApp/hooks/useParamsUrl.tsx +++ b/src/features/AuthServiceApp/hooks/useParamsUrl.tsx @@ -1,3 +1,5 @@ +import { useMemo } from 'react' + import { useLocation } from 'react-router' import { getClientSettings } from 'features/AuthStore/helpers' @@ -15,9 +17,19 @@ export const useParamsUrl = () => { scope, } = getClientSettings() - const urlSearchParams = new URLSearchParams(location.search) + const urlSearchParams = useMemo(() => new URLSearchParams(location.search), [location.search]) - const params = Object.fromEntries(urlSearchParams.entries()) + // safari начал поддержку Object.fromEntries с версии 12.1 + const params = useMemo(() => { + let result = {} + for (const [key, value] of urlSearchParams.entries()) { + result = { + ...result, + [key]: value, + } + } + return result + }, [urlSearchParams]) return { client_id, diff --git a/tsconfig.json b/tsconfig.json index 58b76a6f..f986ca28 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -19,7 +19,8 @@ "isolatedModules": true, "noEmit": true, "jsx": "react-jsx", - "noFallthroughCasesInSwitch": true + "noFallthroughCasesInSwitch": true, + "downlevelIteration": true }, "include": ["src"] }