You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
853 B
34 lines
853 B
import { ReactNode, useEffect } from 'react'
|
|
|
|
import { useMatomo } from '@jonkoops/matomo-tracker-react'
|
|
|
|
import { getLanguageUrlParam } from 'helpers/languageUrlParam'
|
|
|
|
import { AuthStore } from 'features/AuthStore'
|
|
import { LexicsStore } from 'features/LexicsStore'
|
|
import { useLocation } from 'react-router'
|
|
|
|
const initialLanguage = getLanguageUrlParam()
|
|
|
|
type Props = {
|
|
children: ReactNode,
|
|
}
|
|
|
|
export const GlobalStores = ({ children }: Props) => {
|
|
const { pathname, search } = useLocation()
|
|
const { trackPageView } = useMatomo()
|
|
|
|
useEffect(() => {
|
|
const isProduction = process.env.REACT_APP_ENV === 'production'
|
|
|
|
if (isProduction) trackPageView()
|
|
}, [trackPageView, pathname, search])
|
|
|
|
return (
|
|
<LexicsStore initialLanguage={initialLanguage}>
|
|
<AuthStore>
|
|
{children}
|
|
</AuthStore>
|
|
</LexicsStore>
|
|
)
|
|
}
|
|
|