Merge pull request #14 from madroneropaulo/patch-1

Update kcContext.ts
This commit is contained in:
Joseph Garrone 2024-04-19 21:53:46 +00:00 committed by GitHub
commit 5b2cdcbd2b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -78,9 +78,9 @@ export const { getKcContext } = createGetKcContext<KcContextExtension>({
"*.example.com", "*.example.com",
"hello-world.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: { 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", existsError: (fieldName: string) => fieldName === "email",
get: (fieldName: string) => `Fake error for ${fieldName}`, get: (fieldName: string) => `Fake error for ${fieldName}`,
exists: (fieldName: string) => fieldName === "email" exists: (fieldName: string) => fieldName === "email"
@ -101,4 +101,4 @@ export const { kcContext } = getKcContext({
}); });
export type KcContext = NonNullable<ReturnType<typeof getKcContext>["kcContext"]>; export type KcContext = NonNullable<ReturnType<typeof getKcContext>["kcContext"]>;