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"] }