2021-03-03 00:04:06 +01:00
|
|
|
|
|
|
|
import { memo } from "react";
|
|
|
|
import { kcContext } from "../kcContext";
|
2021-03-04 21:14:54 +01:00
|
|
|
import { assert } from "../tools/assert";
|
2021-03-03 00:04:06 +01:00
|
|
|
import type { KcPagesProperties } from "./KcProperties";
|
|
|
|
import { Login } from "./Login";
|
2021-03-04 18:15:48 +01:00
|
|
|
import { Register } from "./Register";
|
2021-03-03 00:04:06 +01:00
|
|
|
|
|
|
|
export type KcAppProps = {
|
|
|
|
kcProperties?: KcPagesProperties;
|
|
|
|
};
|
|
|
|
|
|
|
|
export const KcApp = memo((props: KcAppProps) => {
|
|
|
|
|
|
|
|
const { kcProperties } = props;
|
|
|
|
|
|
|
|
assert(kcContext !== undefined, "App is not currently served by a Keycloak server");
|
|
|
|
|
|
|
|
switch (kcContext.pageBasename) {
|
2021-03-04 18:15:48 +01:00
|
|
|
case "login.ftl": return <Login kcProperties={kcProperties} />;
|
|
|
|
case "register.ftl": return <Register kcProperties={kcProperties} />;
|
2021-03-03 00:04:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
});
|