Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Optimized attributes loading - @andrzejewsky (#3948)
- Improve typescript support for test utils - @resubaka (#4067)
- Removed `product/loadConfigurableAttributes` calls - @andrzejewsky, @gibkigonzo (#3336)
- Disable `mapFallback` url by default - @gibkigonzo(#4092)

## [1.11.1] - 2020.02.05

Expand Down
1 change: 1 addition & 0 deletions config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,7 @@
}
},
"urlModule": {
"enableMapFallbackUrl": false,
"endpoint": "/api/url",
"map_endpoint": "/api/url/map"
}
Expand Down
11 changes: 9 additions & 2 deletions core/modules/url/store/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ export const actions: ActionTree<UrlState, any> = {
if (routeData !== null) {
return resolve(parametrizeRouteData(routeData, query, storeCodeInPath))
} else {
dispatch('mapFallbackUrl', { url, params: parsedQuery }).then(mappedFallback => {
const mappingActionName = config.urlModule.enableMapFallbackUrl ? 'mapFallbackUrl' : 'mappingFallback'
dispatch(mappingActionName, { url, params: parsedQuery }).then(mappedFallback => {
const routeData = getFallbackRouteData({ mappedFallback, url })
dispatch('registerMapping', { url, routeData }) // register mapping for further usage
resolve(parametrizeRouteData(routeData, query, storeCodeInPath))
Expand All @@ -75,7 +76,10 @@ export const actions: ActionTree<UrlState, any> = {
* This method could be overriden in custom module to provide custom URL mapping logic
*/
async mappingFallback ({ dispatch }, { url, params }: { url: string, params: any}) {
console.warn('Deprecated action mappingFallback - use mapFallbackUrl instead')
console.warn(`
Deprecated action mappingFallback - use mapFallbackUrl instead.
You can enable mapFallbackUrl by changing 'config.urlModule.enableMapFallbackUrl' to true
`)
const { storeCode, appendStoreCode } = currentStoreView()
const productQuery = new SearchQuery()
url = (removeStoreCodeFromRoute(url.startsWith('/') ? url.slice(1) : url) as string)
Expand Down Expand Up @@ -152,6 +156,9 @@ export const actions: ActionTree<UrlState, any> = {
})
}
)
if (!response.ok) {
return null
}
response = await response.json()
return response
} catch (err) {
Expand Down