rename pageBasename by pageId
This commit is contained in:
38
src/lib/components/Error.tsx
Normal file
38
src/lib/components/Error.tsx
Normal file
@ -0,0 +1,38 @@
|
||||
|
||||
import { memo } from "react";
|
||||
import { Template } from "./Template";
|
||||
import type { KcProps } from "./KcProps";
|
||||
import { assert } from "../tools/assert";
|
||||
import { kcContext } from "../kcContext";
|
||||
import { useKcTranslation } from "../i18n/useKcTranslation";
|
||||
|
||||
export const Error = memo((props: KcProps) => {
|
||||
|
||||
const { t } = useKcTranslation();
|
||||
|
||||
assert(
|
||||
kcContext !== undefined &&
|
||||
kcContext.pageId === "error.ftl" &&
|
||||
kcContext.message !== undefined
|
||||
);
|
||||
|
||||
const { message, client } = kcContext;
|
||||
|
||||
return (
|
||||
<Template
|
||||
{...props}
|
||||
displayMessage={false}
|
||||
headerNode={t("errorTitle")}
|
||||
formNode={
|
||||
<div id="kc-error-message">
|
||||
<p className="instruction">{message.summary}</p>
|
||||
<#if client?? && client.baseUrl?has_content>
|
||||
<p><a id="backToApplication" href="${client.baseUrl}">${kcSanitize(msg("backToApplication"))?no_esc}</a></p>
|
||||
</#if>
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -12,7 +12,7 @@ export const Info = memo((props: KcProps) => {
|
||||
|
||||
assert(
|
||||
kcContext !== undefined &&
|
||||
kcContext.pageBasename === "info.ftl" &&
|
||||
kcContext.pageId === "info.ftl" &&
|
||||
kcContext.message !== undefined
|
||||
);
|
||||
|
||||
|
@ -12,7 +12,7 @@ export const KcApp = memo((props: KcProps) => {
|
||||
|
||||
assert(kcContext !== undefined, "App is not currently served by a Keycloak server");
|
||||
|
||||
switch (kcContext.pageBasename) {
|
||||
switch (kcContext.pageId) {
|
||||
case "login.ftl": return <Login {...props} />;
|
||||
case "register.ftl": return <Register {...props} />;
|
||||
case "info.ftl": return <Info {...props} />;
|
||||
|
@ -14,7 +14,7 @@ export const Login = memo((props: KcProps) => {
|
||||
|
||||
assert(
|
||||
kcContext !== undefined &&
|
||||
kcContext.pageBasename === "login.ftl"
|
||||
kcContext.pageId === "login.ftl"
|
||||
);
|
||||
|
||||
const {
|
||||
|
@ -12,7 +12,7 @@ export const Register = memo((props: KcProps) => {
|
||||
|
||||
assert(
|
||||
kcContext !== undefined &&
|
||||
kcContext.pageBasename === "register.ftl"
|
||||
kcContext.pageId === "register.ftl"
|
||||
);
|
||||
|
||||
const {
|
||||
|
Reference in New Issue
Block a user