keycloakify-custom/src/index.tsx

29 lines
992 B
TypeScript
Raw Normal View History

2022-09-06 17:22:23 +00:00
import { createRoot } from "react-dom/client";
import { StrictMode, lazy, Suspense } from "react";
import { kcContext as kcLoginThemeContext } from "./keycloak-theme/login/kcContext";
2023-03-21 16:19:01 +00:00
import { kcContext as kcAccountThemeContext } from "./keycloak-theme/account/kcContext";
2022-09-06 17:22:23 +00:00
const KcLoginThemeApp = lazy(() => import("./keycloak-theme/login/KcApp"));
2023-03-21 16:19:01 +00:00
const KcAccountThemeApp = lazy(() => import("./keycloak-theme/account/KcApp"));
const App = lazy(() => import("./App"));
2022-09-06 17:22:23 +00:00
createRoot(document.getElementById("root")!).render(
<StrictMode>
2023-02-27 09:13:07 +00:00
<Suspense>
{(()=>{
if( kcLoginThemeContext !== undefined ){
return <KcLoginThemeApp kcContext={kcLoginThemeContext} />;
}
2023-03-21 16:19:01 +00:00
if( kcAccountThemeContext !== undefined ){
return <KcAccountThemeApp kcContext={kcAccountThemeContext} />;
}
return <App />;
})()}
2023-02-27 09:13:07 +00:00
</Suspense>
</StrictMode>
2022-09-06 17:22:23 +00:00
);