2022-06-11 03:08:49 +00:00
|
|
|
import { AppProps } from 'next/app'
|
2022-06-04 03:13:19 +00:00
|
|
|
import { appWithTranslation, useTranslation } from 'next-i18next'
|
2022-06-01 23:29:37 +00:00
|
|
|
import { SWRConfig } from 'swr'
|
2022-06-11 03:08:49 +00:00
|
|
|
import { AxiosSWRFetcherProvider, useAxiosSWRFetcher } from '../components/auth/requests'
|
|
|
|
import { useStatePostcard } from '../components/postcard/storage'
|
|
|
|
import { PageErrorBoundary } from '../components/generic/errors/boundaries'
|
|
|
|
import { PostcardContext } from '../components/postcard/base'
|
|
|
|
import { useStateAuth } from '../components/auth/storage'
|
|
|
|
import { AuthContext } from '../components/auth/base'
|
|
|
|
import { PostcardRenderer } from '../components/postcard/renderer'
|
|
|
|
import '../styles/globals.css'
|
2022-06-09 21:43:38 +00:00
|
|
|
import defaultPostcard from "../public/postcards/adi-goldstein-Hli3R6LKibo-unsplash.jpg"
|
2022-05-27 00:46:30 +00:00
|
|
|
|
2022-05-20 11:59:24 +00:00
|
|
|
|
2022-05-25 14:20:22 +00:00
|
|
|
const App = ({ Component, pageProps }: AppProps): JSX.Element => {
|
2022-06-09 21:43:38 +00:00
|
|
|
const { t } = useTranslation()
|
2022-06-11 03:08:49 +00:00
|
|
|
const postcardState = useStatePostcard(defaultPostcard)
|
|
|
|
const authState = useStateAuth()
|
2022-05-31 15:07:25 +00:00
|
|
|
|
2022-06-11 03:08:49 +00:00
|
|
|
return (
|
|
|
|
<PageErrorBoundary text={t("genericError")}>
|
|
|
|
<AxiosSWRFetcherProvider>
|
|
|
|
<PostcardContext.Provider value={postcardState}>
|
|
|
|
<AuthContext.Provider value={authState}>
|
|
|
|
<AxiosSWRFetcherProvider>
|
|
|
|
<PostcardRenderer />
|
|
|
|
<Component {...pageProps} />
|
|
|
|
</AxiosSWRFetcherProvider>
|
|
|
|
</AuthContext.Provider>
|
|
|
|
</PostcardContext.Provider>
|
|
|
|
</AxiosSWRFetcherProvider>
|
|
|
|
</PageErrorBoundary>
|
|
|
|
)
|
2022-05-20 11:59:24 +00:00
|
|
|
}
|
|
|
|
|
2022-05-25 14:20:22 +00:00
|
|
|
export default appWithTranslation(App)
|