Fix: kcContext.scripts can be undefined in error.ftl

This commit is contained in:
Joseph Garrone 2024-10-30 15:51:16 +01:00
parent 263f55fdd3
commit e261736fa3
2 changed files with 8 additions and 6 deletions

View File

@ -102,7 +102,7 @@ export declare namespace KcContext {
showTryAnotherWayLink?: boolean; showTryAnotherWayLink?: boolean;
attemptedUsername?: string; attemptedUsername?: string;
}; };
scripts: string[]; scripts?: string[];
message?: { message?: {
type: "success" | "warning" | "error" | "info"; type: "success" | "warning" | "error" | "info";
summary: string; summary: string;

View File

@ -10,7 +10,7 @@ export type KcContextLike = {
resourcesPath: string; resourcesPath: string;
ssoLoginInOtherTabsUrl: string; ssoLoginInOtherTabsUrl: string;
}; };
scripts: string[]; scripts?: string[];
}; };
assert<keyof KcContextLike extends keyof KcContext ? true : false>(); assert<keyof KcContextLike extends keyof KcContext ? true : false>();
@ -45,10 +45,12 @@ export function useInitialize(params: {
type: "module", type: "module",
src: `${url.resourcesPath}/js/menu-button-links.js` src: `${url.resourcesPath}/js/menu-button-links.js`
}, },
...scripts.map(src => ({ ...(scripts === undefined
type: "text/javascript" as const, ? []
src : scripts.map(src => ({
})), type: "text/javascript" as const,
src
}))),
{ {
type: "module", type: "module",
textContent: ` textContent: `