2023-03-20 05:14:25 +01:00
|
|
|
import { lazy, Suspense } from "react";
|
|
|
|
import type { PageProps } from "keycloakify/account/pages/PageProps";
|
|
|
|
import type { I18n } from "keycloakify/account/i18n";
|
|
|
|
import type { KcContext } from "./kcContext";
|
|
|
|
import { assert, type Equals } from "tsafe/assert";
|
|
|
|
|
|
|
|
const Password = lazy(() => import("keycloakify/account/pages/Password"));
|
|
|
|
const Account = lazy(() => import("keycloakify/account/pages/Account"));
|
2024-02-07 15:18:27 +02:00
|
|
|
const Sessions = lazy(() => import("keycloakify/account/pages/Sessions"));
|
2024-02-16 17:40:12 +02:00
|
|
|
const Totp = lazy(() => import("keycloakify/account/pages/Totp"));
|
2024-02-19 17:29:46 +02:00
|
|
|
const Applications = lazy(() => import("keycloakify/account/pages/Applications"));
|
2023-03-20 05:14:25 +01:00
|
|
|
|
|
|
|
export default function Fallback(props: PageProps<KcContext, I18n>) {
|
|
|
|
const { kcContext, ...rest } = props;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Suspense>
|
|
|
|
{(() => {
|
|
|
|
switch (kcContext.pageId) {
|
|
|
|
case "password.ftl":
|
|
|
|
return <Password kcContext={kcContext} {...rest} />;
|
2024-02-07 15:18:27 +02:00
|
|
|
case "sessions.ftl":
|
|
|
|
return <Sessions kcContext={kcContext} {...rest} />;
|
2023-03-20 05:14:25 +01:00
|
|
|
case "account.ftl":
|
|
|
|
return <Account kcContext={kcContext} {...rest} />;
|
2024-02-16 17:40:12 +02:00
|
|
|
case "totp.ftl":
|
|
|
|
return <Totp kcContext={kcContext} {...rest} />;
|
2024-02-19 17:29:46 +02:00
|
|
|
case "applications.ftl":
|
|
|
|
return <Applications kcContext={kcContext} {...rest} />;
|
2023-03-20 05:14:25 +01:00
|
|
|
}
|
|
|
|
assert<Equals<typeof kcContext, never>>(false);
|
|
|
|
})()}
|
|
|
|
</Suspense>
|
|
|
|
);
|
|
|
|
}
|