diff --git a/apps/nextjs-app/src/features/i18n/share.config.ts b/apps/nextjs-app/src/features/i18n/share.config.ts index 973fe3050..b63e906bf 100644 --- a/apps/nextjs-app/src/features/i18n/share.config.ts +++ b/apps/nextjs-app/src/features/i18n/share.config.ts @@ -2,9 +2,9 @@ import type { I18nActiveNamespaces } from '@/lib/i18n'; export interface IShareConfig { // Define namespaces in use in both the type and the config. - i18nNamespaces: I18nActiveNamespaces<'share' | 'sdk'>; + i18nNamespaces: I18nActiveNamespaces<'share' | 'common' | 'table' | 'sdk'>; } export const shareConfig: IShareConfig = { - i18nNamespaces: ['share', 'sdk'], + i18nNamespaces: ['share', 'common', 'table', 'sdk'], }; diff --git a/apps/nextjs-app/src/pages/share/[shareId]/view/index.tsx b/apps/nextjs-app/src/pages/share/[shareId]/view/index.tsx index 25fbcc5c5..123ef6f99 100644 --- a/apps/nextjs-app/src/pages/share/[shareId]/view/index.tsx +++ b/apps/nextjs-app/src/pages/share/[shareId]/view/index.tsx @@ -4,19 +4,23 @@ import type { GetServerSideProps } from 'next'; import { ssrApi } from '@/backend/api/rest/table.ssr'; import type { IShareViewPageProps } from '@/features/app/blocks/share/view/ShareViewPage'; import { ShareViewPage } from '@/features/app/blocks/share/view/ShareViewPage'; +import { shareConfig } from '@/features/i18n/share.config'; +import { getTranslationsProps } from '@/lib/i18n'; -export const getServerSideProps: GetServerSideProps = async ({ - res, - req, - query, -}) => { +export const getServerSideProps: GetServerSideProps = async (context) => { + const { res, req, query } = context; const { shareId } = query; + const { i18nNamespaces } = shareConfig; + try { res.setHeader('Content-Security-Policy', "frame-ancestors 'self' *;"); ssrApi.axios.defaults.headers['cookie'] = req.headers.cookie || ''; const shareViewData = await ssrApi.getShareView(shareId as string); return { - props: { shareViewData }, + props: { + shareViewData, + ...(await getTranslationsProps(context, i18nNamespaces)), + }, }; } catch (e) { const error = e as IHttpError;