2024-06-05 23:44:57 +00:00
|
|
|
/* eslint-disable react-refresh/only-export-components */
|
2022-09-06 17:22:23 +00:00
|
|
|
import { createRoot } from "react-dom/client";
|
|
|
|
import { StrictMode, lazy, Suspense } from "react";
|
|
|
|
|
2024-06-05 23:44:57 +00:00
|
|
|
const KcLoginThemeApp = lazy(() => import("./login/KcApp"));
|
|
|
|
const KcAccountThemeApp = lazy(() => import("./account/KcApp"));
|
2022-09-06 17:22:23 +00:00
|
|
|
|
2024-06-06 03:26:06 +00:00
|
|
|
let { kcContext } = window;
|
|
|
|
|
|
|
|
// NOTE: This is just to test a specific page when you run `yarn dev`
|
|
|
|
// however the recommended way to develope is to use the Storybook
|
|
|
|
if (kcContext === undefined) {
|
|
|
|
kcContext = (await import("./login/PageStory")).getKcContextMock({
|
|
|
|
pageId: "register.ftl"
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2022-09-06 17:22:23 +00:00
|
|
|
createRoot(document.getElementById("root")!).render(
|
|
|
|
<StrictMode>
|
2023-02-27 09:13:07 +00:00
|
|
|
<Suspense>
|
2024-06-05 23:44:57 +00:00
|
|
|
{(() => {
|
|
|
|
switch (kcContext?.themeType) {
|
2024-06-06 03:26:06 +00:00
|
|
|
case "login":
|
|
|
|
return <KcLoginThemeApp kcContext={kcContext} />;
|
|
|
|
case "account":
|
|
|
|
return <KcAccountThemeApp kcContext={kcContext} />;
|
|
|
|
case undefined:
|
|
|
|
return <h1>No Keycloak Context</h1>;
|
2023-03-21 16:19:01 +00:00
|
|
|
}
|
2023-03-21 01:55:32 +00:00
|
|
|
})()}
|
2023-02-27 09:13:07 +00:00
|
|
|
</Suspense>
|
|
|
|
</StrictMode>
|
2022-09-06 17:22:23 +00:00
|
|
|
);
|