1
0
Fork 0
freesewing/sites/org/pages/account/newsletter.mjs

52 lines
1.4 KiB
JavaScript
Raw Normal View History

2023-02-18 16:11:02 +01:00
// Hooks
import { useApp } from 'shared/hooks/use-app.mjs'
2023-02-18 16:11:02 +01:00
// Dependencies
import dynamic from 'next/dynamic'
import { serverSideTranslations } from 'next-i18next/serverSideTranslations'
// Components
import { PageWrapper, ns as pageNs } from 'shared/components/wrappers/page.mjs'
import { ns as authNs } from 'shared/components/wrappers/auth/index.mjs'
import { ns as newsletterNs } from 'shared/components/account/newsletter.mjs'
2023-02-18 16:11:02 +01:00
// Translation namespaces used on this page
const namespaces = [...new Set([...newsletterNs, ...authNs, ...pageNs])]
/*
* Some things should never generated as SSR
* So for these, we run a dynamic import and disable SSR rendering
*/
const DynamicAuthWrapper = dynamic(
() => import('shared/components/wrappers/auth/index.mjs').then((mod) => mod.AuthWrapper),
2023-02-18 16:11:02 +01:00
{ ssr: false }
)
const DynamicNewsletter = dynamic(
() => import('shared/components/account/newsletter.mjs').then((mod) => mod.NewsletterSettings),
2023-02-18 16:11:02 +01:00
{ ssr: false }
)
const AccountPage = (props) => {
const app = useApp(props)
return (
2023-03-27 19:21:27 +02:00
<PageWrapper app={app}>
2023-02-18 16:11:02 +01:00
<DynamicAuthWrapper app={app}>
<DynamicNewsletter app={app} title />
</DynamicAuthWrapper>
</PageWrapper>
)
}
export default AccountPage
export async function getStaticProps({ locale }) {
return {
props: {
...(await serverSideTranslations(locale, namespaces)),
2023-03-27 19:21:27 +02:00
page: {
path: ['account', 'newsletter'],
},
2023-02-18 16:11:02 +01:00
},
}
}