Skip to content

Instantly share code, notes, and snippets.

@mattbrailsford
Last active September 22, 2020 12:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattbrailsford/4bd7e051a573b6eed29e0471dc80cfdc to your computer and use it in GitHub Desktop.
Save mattbrailsford/4bd7e051a573b6eed29e0471dc80cfdc to your computer and use it in GitHub Desktop.
(function () {
'use strict';
var routeMap = [
{
pattern: /^views\/vendrproductreviews\/(.*)-(.*).html(.*)$/gi,
map: '/app_plugins/vendrproductreviews/views/$1/$2.html$3'
},
{
pattern: /^views\/vendrproductreviews\/(.*).html(.*)$/gi,
map: '/app_plugins/vendrproductreviews/views/$1/edit.html$3'
}
];
function routeRewritesInterceptor($q) {
return {
'request': function (config) {
routeMap.forEach(function (m) {
config.url = config.url.replace(m.pattern, m.map);
});
return config || $q.when(config);
}
};
}
angular.module('vendr.interceptors').factory('routeRewritesInterceptor', routeRewritesInterceptor);
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment