From dfcd6685cb817a1b9e37012f1e0a3d8562a3a497 Mon Sep 17 00:00:00 2001 From: Luke Romanowicz Date: Fri, 13 Sep 2019 10:59:51 +0200 Subject: [PATCH] Minor code cleanup, changelog update --- CHANGELOG.md | 2 +- core/lib/multistore.ts | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e9ebf143ee..ff2b4bcdcb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -82,7 +82,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed warning in product details because of duplicate `product` property in `AddToCompare` mixin - @cewald (#3428) - Fixed "Clear Wishlist" Button - @dz3n (#3522) - Fixed hash in dynamically resolved urls causing resolving issues - @lukeromanowicz (#3515) -- Fix invalid routes in ButtonOutline - @lukeromanowicz +- Fix invalid routes in ButtonOutline - @lukeromanowicz (#3541) ### Changed / Improved diff --git a/core/lib/multistore.ts b/core/lib/multistore.ts index cde2f1d193..7db1ed75b1 100644 --- a/core/lib/multistore.ts +++ b/core/lib/multistore.ts @@ -233,18 +233,18 @@ export function localizedRoute (routeObj: LocalizedRoute | string | RouteConfig return localizedDispatcherRoute(Object.assign({}, routeObj) as LocalizedRoute, storeCode) } } - if (storeCode && routeObj && config.defaultStoreCode !== storeCode && config.storeViews[storeCode].appendStoreCode) { - if (typeof routeObj === 'object') { - if (routeObj.name) { - routeObj.name = storeCode + '-' + routeObj.name - } - if (routeObj.path) { - routeObj.path = '/' + storeCode + '/' + (routeObj.path.startsWith('/') ? routeObj.path.slice(1) : routeObj.path) - } - } else { + if (storeCode && config.defaultStoreCode !== storeCode && config.storeViews[storeCode].appendStoreCode) { + if (typeof routeObj !== 'object') { return '/' + storeCode + routeObj } + if (routeObj.name) { + routeObj.name = storeCode + '-' + routeObj.name + } + + if (routeObj.path) { + routeObj.path = '/' + storeCode + '/' + (routeObj.path.startsWith('/') ? routeObj.path.slice(1) : routeObj.path) + } } return routeObj