@@ -85,30 +85,17 @@ export const actions: ActionTree<UrlState, any> = {
8585 Deprecated action mappingFallback - use mapFallbackUrl instead.
8686 You can enable mapFallbackUrl by changing 'config.urlModule.enableMapFallbackUrl' to true
8787 ` ) ( )
88- const { storeCode, appendStoreCode } = currentStoreView ( )
8988 const productQuery = new SearchQuery ( )
9089 url = ( removeStoreCodeFromRoute ( url . startsWith ( '/' ) ? url . slice ( 1 ) : url ) as string )
9190 productQuery . applyFilter ( { key : 'url_path' , value : { 'eq' : url } } ) // Tees category
9291 const products = await dispatch ( 'product/list' , { query : productQuery } , { root : true } )
9392 if ( products && products . items && products . items . length ) {
9493 const product = products . items [ 0 ]
95- return {
96- name : localizedDispatcherRouteName ( product . type_id + '-product' , storeCode , appendStoreCode ) ,
97- params : {
98- slug : product . slug ,
99- parentSku : product . sku ,
100- childSku : params [ 'childSku' ] ? params [ 'childSku' ] : product . sku
101- }
102- }
94+ return transformProductUrl ( product , params )
10395 } else {
10496 const category = await dispatch ( 'category/single' , { key : 'url_path' , value : url } , { root : true } )
10597 if ( category !== null ) {
106- return {
107- name : localizedDispatcherRouteName ( 'category' , storeCode , appendStoreCode ) ,
108- params : {
109- slug : category . slug
110- }
111- }
98+ return transformCategoryUrl ( category )
11299 }
113100 }
114101 } ,
0 commit comments