2022-05-16 14:25:01 +02:00
|
|
|
import { useEffect } from 'react'
|
2022-03-17 01:11:10 +01:00
|
|
|
import type { AppProps } from 'next/app'
|
2022-05-16 14:25:01 +02:00
|
|
|
import useTranslation from 'next-translate/useTranslation'
|
|
|
|
import Cookies from 'js-cookie'
|
2022-02-12 23:07:11 +01:00
|
|
|
|
2022-03-17 01:11:10 +01:00
|
|
|
import '../styles/main.scss'
|
2022-02-12 23:07:11 +01:00
|
|
|
|
2022-03-24 01:44:55 +01:00
|
|
|
const MyApp = ({ Component, pageProps }: AppProps): JSX.Element => {
|
2022-05-16 14:25:01 +02:00
|
|
|
const { lang } = useTranslation()
|
|
|
|
|
|
|
|
// 10 years before cookie's expiration
|
|
|
|
const COOKIE_EXPIRATION = 10 * 365.25 * 24 * 60 * 60
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
Cookies.set('NEXT_LOCALE', lang, { expires: COOKIE_EXPIRATION })
|
|
|
|
}, [lang, COOKIE_EXPIRATION])
|
|
|
|
|
2022-03-17 01:11:10 +01:00
|
|
|
return <Component {...pageProps} />
|
|
|
|
}
|
2022-02-12 23:07:11 +01:00
|
|
|
|
2022-03-17 01:11:10 +01:00
|
|
|
export default MyApp
|