Ignore mock when in Keycloak: https://github.com/InseeFrLab/keycloakify/discussions/186#discussioncomment-3809320
This commit is contained in:
parent
aad50377ff
commit
8807743daf
@ -17,7 +17,9 @@ export function getKcContext<KcContextExtended extends { pageId: string } = neve
|
|||||||
}): { kcContext: ExtendsKcContextBase<KcContextExtended> | undefined } {
|
}): { kcContext: ExtendsKcContextBase<KcContextExtended> | undefined } {
|
||||||
const { mockPageId, mockData } = params ?? {};
|
const { mockPageId, mockData } = params ?? {};
|
||||||
|
|
||||||
if (mockPageId !== undefined) {
|
const realKcContext = getKcContextFromWindow<KcContextExtended>();
|
||||||
|
|
||||||
|
if (mockPageId !== undefined && realKcContext === undefined) {
|
||||||
//TODO maybe trow if no mock fo custom page
|
//TODO maybe trow if no mock fo custom page
|
||||||
|
|
||||||
const kcContextDefaultMock = kcContextMocks.find(({ pageId }) => pageId === mockPageId);
|
const kcContextDefaultMock = kcContextMocks.find(({ pageId }) => pageId === mockPageId);
|
||||||
@ -106,13 +108,15 @@ export function getKcContext<KcContextExtended extends { pageId: string } = neve
|
|||||||
return { kcContext };
|
return { kcContext };
|
||||||
}
|
}
|
||||||
|
|
||||||
const kcContext = getKcContextFromWindow<KcContextExtended>();
|
if (realKcContext === undefined) {
|
||||||
|
return { "kcContext": undefined };
|
||||||
|
}
|
||||||
|
|
||||||
if (kcContext !== undefined) {
|
{
|
||||||
const { url } = kcContext;
|
const { url } = realKcContext;
|
||||||
|
|
||||||
url.resourcesCommonPath = pathJoin(url.resourcesPath, pathBasename(mockTestingResourcesCommonPath));
|
url.resourcesCommonPath = pathJoin(url.resourcesPath, pathBasename(mockTestingResourcesCommonPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
return { kcContext };
|
return { "kcContext": realKcContext };
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user