Skip to content

Commit

Permalink
Merge pull request #4284 from Hyperkid123/router-debug
Browse files Browse the repository at this point in the history
Configure app to work with react HashRouter
  • Loading branch information
himdel authored Jul 12, 2018
2 parents 44c3ac8 + 08e3ee9 commit 896ba38
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
6 changes: 0 additions & 6 deletions app/assets/javascripts/angular_modules/module_report_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,4 @@ miqHttpInject(
angular.module('ManageIQ.report_data', [
'miqStaticAssets', 'ui.bootstrap', 'patternfly.views',
])
.config(['$locationProvider', function($locationProvider) {
$locationProvider.html5Mode({
enabled: true,
requireBase: false,
});
}])
);
8 changes: 1 addition & 7 deletions app/assets/javascripts/angular_modules/module_toolbar.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
miqHttpInject(
angular.module('ManageIQ.toolbar', [
'miqStaticAssets', 'ui.bootstrap'
'miqStaticAssets', 'ui.bootstrap',
])
.config(['$locationProvider', function ($locationProvider) {
$locationProvider.html5Mode({
enabled: false,
requireBase: false,
});
}])
);
8 changes: 8 additions & 0 deletions app/assets/javascripts/miq_angular_application.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ ManageIQ.constants = {
};

function miqHttpInject(angular_app) {
angular_app.config(['$locationProvider', function($locationProvider) {
/**
* hashPrefix must be empty othervise it will conflict with HashRouter and create infinite loop
* React HashRouter can be configured to have hashbang prefix,
* but both $locationProvider and ReactRouter must have the same prefix!
*/
$locationProvider.hashPrefix('');
}]);
angular_app.config(['$httpProvider', function($httpProvider) {
$httpProvider.defaults.headers.common['X-Angular-Request'] = true;
$httpProvider.defaults.headers.common['X-CSRF-Token'] = function() {
Expand Down

0 comments on commit 896ba38

Please sign in to comment.