Skip to content

Commit

Permalink
fix: add validation to set 0 on channelid when multistorefront is dis…
Browse files Browse the repository at this point in the history
…abled (#858)

fix: add validation to set 0 on storechannel when multistorefront is disabled
  • Loading branch information
bc-marco authored and libruce committed Dec 27, 2023
1 parent 233a35b commit 1a3d944
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
6 changes: 5 additions & 1 deletion apps/storefront/src/components/B3StoreContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export default function B3StoreContainer(props: B3StoreContainerProps) {
b2bChannelId,
storeName: storeBasicInfo.storeName,
timeFormat: storeBasicInfo.timeFormat,
multiStorefrontEnabled: storeBasicInfo.multiStorefrontEnabled,
},
})

Expand All @@ -86,7 +87,10 @@ export default function B3StoreContainer(props: B3StoreContainerProps) {
}

if (translationVersion > 0) {
setGlobalTranslation({ translationVersion, channelId })
setGlobalTranslation({
translationVersion,
channelId: storeBasicInfo.multiStorefrontEnabled ? channelId : 0,
})
}

store.dispatch(setHeadLessBcUrl(bcUrl))
Expand Down
8 changes: 7 additions & 1 deletion apps/storefront/src/components/layout/B3RenderRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,13 @@ export default function B3RenderRouter(props: B3RenderRouterProps) {
const [, page] = location.pathname.split('/')
if (!page) return

setTranslation({ channelId: globaledState.currentChannelId, page })
let channelId = globaledState.currentChannelId

if (!globaledState.multiStorefrontEnabled) {
channelId = 0
}

setTranslation({ channelId, page })
}, [location.pathname])

return (
Expand Down
2 changes: 2 additions & 0 deletions apps/storefront/src/shared/global/context/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ export interface GlobalState {
blockPendingAccountOrderCreation: boolean
quoteDetailHasNewMessages: boolean
shoppingListClickNode: HTMLElement | null
multiStorefrontEnabled: boolean
}

export const initState = {
Expand Down Expand Up @@ -183,6 +184,7 @@ export const initState = {
quoteDetailHasNewMessages: false,
shoppingListClickNode: null,
tipMessage: {},
multiStorefrontEnabled: false,
}

export interface GlobalAction {
Expand Down

0 comments on commit 1a3d944

Please sign in to comment.