Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update kcContext.ts #14

Merged
merged 1 commit into from
Apr 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/keycloak-theme/login/kcContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ export const { getKcContext } = createGetKcContext<KcContextExtension>({
"*.example.com",
"hello-world.com"
],
// Simulate we got an error with the email field
// Simulate we got an error with the email field. Return text if message for given field exists.
messagesPerField: {
printIfExists: <T>(fieldName: string, className: T) => { console.log({ fieldName }); return fieldName === "email" ? className : undefined; },
printIfExists: <T>(fieldName: string, text: T) => { console.log({ fieldName }); return fieldName === "email" ? text : undefined; },
existsError: (fieldName: string) => fieldName === "email",
get: (fieldName: string) => `Fake error for ${fieldName}`,
exists: (fieldName: string) => fieldName === "email"
Expand All @@ -97,4 +97,4 @@ export const { kcContext } = getKcContext({
});


export type KcContext = NonNullable<ReturnType<typeof getKcContext>["kcContext"]>;
export type KcContext = NonNullable<ReturnType<typeof getKcContext>["kcContext"]>;
Loading