import { ReactNode } from 'react'

import { getLanguageUrlParam } from 'helpers/languageUrlParam'

import { AuthStore } from 'features/AuthStore'
import { LexicsStore } from 'features/LexicsStore'

const initialLanguage = getLanguageUrlParam()

type Props = {
  children: ReactNode,
}

export const GlobalStores = ({ children }: Props) => (
  <LexicsStore initialLanguage={initialLanguage}>
    <AuthStore>
      {children}
    </AuthStore>
  </LexicsStore>
)
