Implement LoginVerifyEmail

This commit is contained in:
Joseph Garrone
2021-03-07 15:37:37 +01:00
parent 438ca4595f
commit adc6d69201
12 changed files with 126 additions and 67 deletions

View File

@ -7,11 +7,11 @@ import { id } from "evt/tools/typeSafety/id";
export type MessageKey = keyof typeof messages["en"];
export function useKcTranslation() {
export function useKcMessage() {
const { kcLanguageTag } = useKcLanguageTag();
const tStr = useConstCallback(
const msgStr = useConstCallback(
(key: MessageKey, ...args: (string | undefined)[]): string => {
let str: string = messages[kcLanguageTag as any as "en"][key] ?? messages["en"][key];
@ -31,13 +31,13 @@ export function useKcTranslation() {
}
);
const t = useConstCallback(
id<(...args: Parameters<typeof tStr>) => ReactNode>(
const msg = useConstCallback(
id<(...args: Parameters<typeof msgStr>) => ReactNode>(
(key, ...args) =>
<span className={key} dangerouslySetInnerHTML={{ "__html": tStr(key, ...args) }} />
<span className={key} dangerouslySetInnerHTML={{ "__html": msgStr(key, ...args) }} />
)
);
return { t, tStr };
return { msg, msgStr };
}