fix(#495): india client fixes #181
Merged
andrey.dekterev
merged 1 commits from in-495-india-insports-tv into develop 3 years ago
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
@ -1,20 +1,52 @@ |
||||
import { ReactNode } from 'react' |
||||
import { |
||||
ReactNode, |
||||
useEffect, |
||||
useState, |
||||
} from 'react' |
||||
|
||||
import { getLanguageUrlParam } from 'helpers/languageUrlParam' |
||||
import { useLocation } from 'react-router' |
||||
|
||||
import { getLanguageUrlParam, redirectToUrl } from 'helpers' |
||||
|
||||
import { AuthStore } from 'features/AuthStore' |
||||
import { LexicsStore } from 'features/LexicsStore' |
||||
|
||||
import { getGeoInfo } from 'requests' |
||||
|
||||
import { isInSportsClient } from 'config' |
||||
|
||||
const initialLanguage = getLanguageUrlParam() |
||||
|
||||
type Props = { |
||||
children: ReactNode, |
||||
} |
||||
|
||||
export const GlobalStores = ({ children }: Props) => ( |
||||
export const GlobalStores = ({ children }: Props) => { |
||||
const { pathname, search } = useLocation() |
||||
const [isGeoReady, setIsGeoReady] = useState(false) |
||||
|
||||
useEffect(() => { |
||||
(async () => { |
||||
if (isInSportsClient) { |
||||
const geo = await getGeoInfo() |
||||
|
||||
if (geo.country_code === 'IN') { |
||||
redirectToUrl(`https://india.insports.tv${pathname}${search}`) |
||||
return |
||||
} |
||||
} |
||||
setIsGeoReady(true) |
||||
})() |
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []) |
||||
|
||||
if (!isGeoReady) return null |
||||
|
||||
return ( |
||||
<LexicsStore initialLanguage={initialLanguage}> |
||||
<AuthStore> |
||||
{children} |
||||
</AuthStore> |
||||
</LexicsStore> |
||||
) |
||||
) |
||||
} |
||||
|
||||
@ -0,0 +1,10 @@ |
||||
export const Rupee = () => ( |
||||
<svg |
||||
viewBox='0 0 13 24' |
||||
xmlns='http://www.w3.org/2000/svg' |
||||
> |
||||
<path |
||||
d='M12.0796 8.06355L11.4833 10.2177H0.0917969L0.688103 8.06355H12.0796ZM6.5664 21.3902L0.4447 14.1731L0.4325 12.3597H3.3413C4.09591 12.3597 4.71647 12.2258 5.20328 11.958C5.69822 11.6822 6.06739 11.3131 6.3108 10.8505C6.5542 10.38 6.6759 9.8567 6.6759 9.28057C6.6759 8.65579 6.56234 8.10406 6.3352 7.62539C6.10806 7.14672 5.74703 6.77348 5.25208 6.50567C4.75714 6.23802 4.10389 6.10412 3.29265 6.10412H0.103997L0.761155 3.66992H3.29265C4.72867 3.66992 5.92145 3.88501 6.87066 4.31504C7.82003 4.74506 8.5299 5.36984 9.0006 6.18922C9.47927 7.00875 9.71861 7.99863 9.71861 9.15887C9.71861 10.173 9.54419 11.0697 9.1952 11.8485C8.84636 12.6194 8.28243 13.244 7.50357 13.7228C6.72471 14.1934 5.69024 14.4854 4.40017 14.599L9.99846 21.2319V21.3902H6.5664ZM12.0918 3.66992L11.4833 5.82411H2.17293L2.76924 3.66992H12.0918Z' |
||||
/> |
||||
</svg> |
||||
) |
||||
Loading…
Reference in new issue