Add a big red warning when kcContext mock is enabled
This commit is contained in:
@ -10,6 +10,7 @@ import { getKcContextFromWindow } from "./getKcContextFromWindow";
|
|||||||
import { pathJoin } from "../../bin/tools/pathJoin";
|
import { pathJoin } from "../../bin/tools/pathJoin";
|
||||||
import { pathBasename } from "../tools/pathBasename";
|
import { pathBasename } from "../tools/pathBasename";
|
||||||
import { mockTestingResourcesCommonPath } from "../../bin/mockTestingResourcesPath";
|
import { mockTestingResourcesCommonPath } from "../../bin/mockTestingResourcesPath";
|
||||||
|
import { symToStr } from "tsafe/symToStr";
|
||||||
|
|
||||||
export function getKcContext<KcContextExtended extends { pageId: string } = never>(params?: {
|
export function getKcContext<KcContextExtended extends { pageId: string } = never>(params?: {
|
||||||
mockPageId?: ExtendsKcContextBase<KcContextExtended>["pageId"];
|
mockPageId?: ExtendsKcContextBase<KcContextExtended>["pageId"];
|
||||||
@ -22,6 +23,14 @@ export function getKcContext<KcContextExtended extends { pageId: string } = neve
|
|||||||
if (mockPageId !== undefined && realKcContext === undefined) {
|
if (mockPageId !== undefined && realKcContext === undefined) {
|
||||||
//TODO maybe trow if no mock fo custom page
|
//TODO maybe trow if no mock fo custom page
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
[
|
||||||
|
`%cKeycloakify: ${symToStr({ mockPageId })} set to ${mockPageId}.`,
|
||||||
|
`If assets are missing make sure you have built your Keycloak theme at least once.`
|
||||||
|
].join(" "),
|
||||||
|
"background: red; color: yellow; font-size: medium"
|
||||||
|
);
|
||||||
|
|
||||||
const kcContextDefaultMock = kcContextMocks.find(({ pageId }) => pageId === mockPageId);
|
const kcContextDefaultMock = kcContextMocks.find(({ pageId }) => pageId === mockPageId);
|
||||||
|
|
||||||
const partialKcContextCustomMock = mockData?.find(({ pageId }) => pageId === mockPageId);
|
const partialKcContextCustomMock = mockData?.find(({ pageId }) => pageId === mockPageId);
|
||||||
|
Reference in New Issue
Block a user