diff --git a/libs/react-spa/bff/src/lib/BffPoller.tsx b/libs/react-spa/bff/src/lib/BffPoller.tsx index 4d48d80b6467e..40f39e7b95744 100644 --- a/libs/react-spa/bff/src/lib/BffPoller.tsx +++ b/libs/react-spa/bff/src/lib/BffPoller.tsx @@ -46,7 +46,7 @@ export const BffPoller = ({ const { signIn, bffUrlGenerator } = useAuth() const userInfo = useUserInfo() const { postMessage } = useBffBroadcaster() - const bffBasePath = bffUrlGenerator() + const bffBaseUrl = bffUrlGenerator() const url = useMemo( () => bffUrlGenerator('/user', { refresh: 'true' }), @@ -87,7 +87,7 @@ export const BffPoller = ({ postMessage({ type: BffBroadcastEvents.NEW_SESSION, userInfo: newUser, - bffBasePath, + bffBaseUrl, }) newSessionCb() diff --git a/libs/react-spa/bff/src/lib/BffProvider.tsx b/libs/react-spa/bff/src/lib/BffProvider.tsx index c510377707155..a8917228a07e9 100644 --- a/libs/react-spa/bff/src/lib/BffProvider.tsx +++ b/libs/react-spa/bff/src/lib/BffProvider.tsx @@ -43,19 +43,19 @@ export const BffProvider = ({ authState === 'logging-out' const isLoggedIn = authState === 'logged-in' const oldLoginPath = `${applicationBasePath}/login` - const bffBasePath = bffUrlGenerator() + const bffBaseUrl = bffUrlGenerator() const { postMessage } = useBffBroadcaster((event) => { /** - * Filter broadcast events by matching BFF base path + * Filter broadcast events by matching BFF base url * * Since the Broadcaster sends messages to all tabs/windows/iframes * sharing the same origin (domain), we need to explicitly check if - * the message belongs to our specific BFF instance by comparing base paths. + * the message belongs to our specific BFF instance by comparing base urls. * This prevents handling events meant for other applications/contexts * running on the same domain. */ - if (event.data.bffBasePath === bffBasePath) { + if (event.data.bffBaseUrl === bffBaseUrl) { if ( isLoggedIn && event.data.type === BffBroadcastEvents.NEW_SESSION && @@ -83,10 +83,10 @@ export const BffProvider = ({ postMessage({ type: BffBroadcastEvents.NEW_SESSION, userInfo: state.userInfo, - bffBasePath, + bffBaseUrl, }) } - }, [postMessage, state.userInfo, isLoggedIn, bffBasePath]) + }, [postMessage, state.userInfo, isLoggedIn, bffBaseUrl]) /** * Builds authentication query parameters for login redirection: @@ -188,13 +188,13 @@ export const BffProvider = ({ // Broadcast to all tabs/windows/iframes that the user is logging out postMessage({ type: BffBroadcastEvents.LOGOUT, - bffBasePath, + bffBaseUrl, }) window.location.href = bffUrlGenerator('/logout', { sid: state.userInfo.profile.sid, }) - }, [bffUrlGenerator, postMessage, state.userInfo, bffBasePath]) + }, [bffUrlGenerator, postMessage, state.userInfo, bffBaseUrl]) const switchUser = useCallback( (nationalId?: string) => { diff --git a/libs/react-spa/bff/src/lib/bff.hooks.ts b/libs/react-spa/bff/src/lib/bff.hooks.ts index 6a8c4f1a11199..019258b759b49 100644 --- a/libs/react-spa/bff/src/lib/bff.hooks.ts +++ b/libs/react-spa/bff/src/lib/bff.hooks.ts @@ -64,12 +64,12 @@ export enum BffBroadcastEvents { type NewSessionEvent = { type: BffBroadcastEvents.NEW_SESSION userInfo: BffUser - bffBasePath: string + bffBaseUrl: string } type LogoutEvent = { type: BffBroadcastEvents.LOGOUT - bffBasePath: string + bffBaseUrl: string } export type BffBroadcastEvent = NewSessionEvent | LogoutEvent