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;
attemptedUsername?: string;
};
scripts: string[];
scripts?: string[];
message?: {
type: "success" | "warning" | "error" | "info";
summary: string;

View File

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