diff --git a/package.json b/package.json index fbdb2707..9715cb94 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "sofa-url-construction-service": "~0.3.x", "sofa-pages-service": "~0.1.0", "sofa-checkout-service": "0.7.x", - "sofa-couch-service": "~0.8.x", + "sofa-couch-service": "~0.14.x", "sofa-coupon-service": "~0.1.0", "sofa-wishlist-service": "~0.2.1", "sofa-image-resizer-service": "~0.2.x", diff --git a/src/app/app.js b/src/app/app.js index 64fd297e..c813315e 100644 --- a/src/app/app.js +++ b/src/app/app.js @@ -289,18 +289,25 @@ angular.module('CouchCommerceApp', [ var navigationService = $injector.get('navigationService'); var $state = $injector.get('$state'); - stateResolverService - .resolveState($location.path()) - .then(function (state) { - $state.transitionTo(state.stateName, state.stateParams, { location: false }); - }, function () { - // since we're generating HTML snapshots for search engines - // via prerender.io, we have to add this meta tag when the - // requested url actually returns a 404 error - // https://prerender.io/getting-started#404s - setPrerenderIOMetaTag('404'); - navigationService.navigateToRootCategory(); - }); + var path = $location.path(); + + if (path.length === 0) { + navigationService.navigateToRootCategory(); + } + else { + stateResolverService + .resolveState(path) + .then(function (state) { + $state.transitionTo(state.stateName, state.stateParams, { location: false }); + }, function () { + // since we're generating HTML snapshots for search engines + // via prerender.io, we have to add this meta tag when the + // requested url actually returns a 404 error + // https://prerender.io/getting-started#404s + setPrerenderIOMetaTag('404'); + navigationService.navigateToRootCategory(); + }); + } }); }) .run(['couchService', 'stateResolverService', function (couchService, stateResolverService) {