Refine CMS i18n fallback, refresh UI, add consent minimize, seed i18n content

Co-authored-by: dennis <dennis@konkol.net>
This commit is contained in:
Cursor Agent
2026-01-12 16:10:22 +00:00
parent 683735cc63
commit 6f1ad8eb4d
10 changed files with 244 additions and 81 deletions

View File

@@ -20,11 +20,17 @@ const Hero = () => {
`/api/content/page?key=${encodeURIComponent("home-hero")}&locale=${encodeURIComponent(locale)}`,
);
const data = await res.json();
if (data?.content?.content) {
// Only use CMS content if it exists for the active locale.
// If the API falls back to another locale, keep showing next-intl strings
// so the locale switch visibly changes the page.
if (data?.content?.content && data?.content?.locale === locale) {
setCmsDoc(data.content.content as JSONContent);
} else {
setCmsDoc(null);
}
} catch {
// ignore; fallback to static
setCmsDoc(null);
}
})();
}, [locale]);