Provide default message for the info page

This commit is contained in:
Joseph Garrone 2024-06-12 09:20:10 +02:00
parent da1dc0309b
commit ee916af48e
3 changed files with 8 additions and 7 deletions

View File

@ -229,6 +229,7 @@ export declare namespace KcContext {
client: {
baseUrl?: string;
};
message: NonNullable<Common["message"]>;
};
export type Error = Common & {

View File

@ -212,6 +212,11 @@ export const kcContextMocks = [
clientId: "myApp",
baseUrl: "#",
attributes: {}
},
message: {
type: "info",
summary:
"This is the info message from the Keycloak server (in real environment, this message is localized)"
}
}),
id<KcContext.Error>({
@ -224,7 +229,8 @@ export const kcContextMocks = [
},
message: {
type: "error",
summary: "This is the error message"
summary:
"This is the error message from the Keycloak server (in real environment, this message is localized)"
}
}),
id<KcContext.LoginResetPassword>({

View File

@ -1,4 +1,3 @@
import { assert } from "keycloakify/tools/assert";
import type { PageProps } from "keycloakify/login/pages/PageProps";
import type { KcContext } from "../KcContext";
import type { I18n } from "../i18n";
@ -8,11 +7,6 @@ export default function Info(props: PageProps<Extract<KcContext, { pageId: "info
const { msgStr, msg } = i18n;
assert(
kcContext.message !== undefined,
"No message in kcContext.message, there will always be a message in production context, add it in your mock"
);
const { messageHeader, message, requiredActions, skipLink, pageRedirectUri, actionUri, client } = kcContext;
return (