Adjustments on the main.tsx
This commit is contained in:
parent
59008f5b87
commit
aad1e69855
11
src/main.tsx
11
src/main.tsx
|
@ -5,12 +5,11 @@ import { StrictMode, lazy, Suspense } from "react";
|
||||||
const KcLoginThemeApp = lazy(() => import("./login/KcApp"));
|
const KcLoginThemeApp = lazy(() => import("./login/KcApp"));
|
||||||
const KcAccountThemeApp = lazy(() => import("./account/KcApp"));
|
const KcAccountThemeApp = lazy(() => import("./account/KcApp"));
|
||||||
|
|
||||||
let { kcContext } = window;
|
|
||||||
|
|
||||||
// NOTE: This is just to test a specific page when you run `yarn dev`
|
// 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
|
// however the recommended way to develope is to use the Storybook
|
||||||
if (kcContext === undefined) {
|
if (window.kcContext === undefined) {
|
||||||
kcContext = (await import("./login/PageStory")).getKcContextMock({
|
window.kcContext = (await import("./login/PageStory")).getKcContextMock({
|
||||||
pageId: "register.ftl"
|
pageId: "register.ftl"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -19,11 +18,11 @@ createRoot(document.getElementById("root")!).render(
|
||||||
<StrictMode>
|
<StrictMode>
|
||||||
<Suspense>
|
<Suspense>
|
||||||
{(() => {
|
{(() => {
|
||||||
switch (kcContext?.themeType) {
|
switch (window.kcContext?.themeType) {
|
||||||
case "login":
|
case "login":
|
||||||
return <KcLoginThemeApp kcContext={kcContext} />;
|
return <KcLoginThemeApp kcContext={window.kcContext} />;
|
||||||
case "account":
|
case "account":
|
||||||
return <KcAccountThemeApp kcContext={kcContext} />;
|
return <KcAccountThemeApp kcContext={window.kcContext} />;
|
||||||
case undefined:
|
case undefined:
|
||||||
return <h1>No Keycloak Context</h1>;
|
return <h1>No Keycloak Context</h1>;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue