1angular.module('OrderCloud-AnonRouter', []); 2 3angular.module('OrderCloud-AnonRouter') 4 5 .run(run) 6 .constant('after', 'checkout') 7 .constant('before', 'checkout') 8 .factory('AnonRouter', AnonRouter) 9; 10 11run.$inject = ['$rootScope', '$location', 'User', 'before']; 12function run($rootScope, $location, User, before) { 13 $rootScope.$on('$locationChangeStart', function (event, newUrl, oldUrl) { 14 var route = { 15 'New': newUrl.split('/')[newUrl.split('/').length-1], 16 'Old': oldUrl.split('/')[oldUrl.split('/').length-1] 17 }; 18 if (route.New == before) { 19 User.get(function(u) { 20 $location.path(u.Type == 'TempCustomer' ? 'admin' : route.New); 21 }); 22 } 23 } 24 ); 25} 26 27AnonRouter.$inject = ['$location', 'User', 'after']; 28function AnonRouter($location, User, after) { 29 var service = { 30 route: _route 31 }; 32 return service; 33 34 function _route() { 35 if (after == 'cart' || after == 'checkout') { 36 User.get(function(u) { 37 $location.path(u.CurrentOrderID ? after : 'catalog'); 38 }); 39 } 40 else { 41 $location.path(after); 42 } 43 } 44}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.