This commit is contained in:
Joseph Garrone 2024-06-06 06:40:23 +02:00
parent 93b304b472
commit 9420dc118a
2 changed files with 13 additions and 9 deletions

View File

@ -28,8 +28,9 @@ export default function KcApp(props: { kcContext: KcContext }) {
} }
})(); })();
// The files are in the public directory. // Dynamically downloading Markdown files from public/terms/[currentLanguage].md
const response = await fetch(`${import.meta.env}terms/${termsFileName}`); // Replace theses files by your organization's terms of service.
const response = await fetch(`${import.meta.env.BASE_URL}terms/${termsFileName}`);
return response.text(); return response.text();
} }

View File

@ -2,17 +2,19 @@
import { createRoot } from "react-dom/client"; import { createRoot } from "react-dom/client";
import { StrictMode, lazy, Suspense } from "react"; import { StrictMode, lazy, Suspense } from "react";
const KcLoginThemeApp = lazy(() => import("./login/KcApp")); // The following block can be uncommented to test a specific page with `yarn dev`
const KcAccountThemeApp = lazy(() => import("./account/KcApp")); /*
import { getKcContextMock } from "./login/PageStory";
if (import.meta.env.DEV) {
// NOTE: This is just to test a specific page when you run `yarn dev` window.kcContext = getKcContextMock({
// however the recommended way to develope is to use the Storybook
if (window.kcContext === undefined) {
window.kcContext = (await import("./login/PageStory")).getKcContextMock({
pageId: "register.ftl" pageId: "register.ftl"
}); });
} }
*/
const KcLoginThemeApp = lazy(() => import("./login/KcApp"));
const KcAccountThemeApp = lazy(() => import("./account/KcApp"));
createRoot(document.getElementById("root")!).render( createRoot(document.getElementById("root")!).render(
<StrictMode> <StrictMode>
@ -30,3 +32,4 @@ createRoot(document.getElementById("root")!).render(
</Suspense> </Suspense>
</StrictMode> </StrictMode>
); );