Commit 98917621 by Vishal Kadam

Merge pull request #14 from MPR-Global/HDPDGI-85-2

HDPDGI-85: Vishal: Pass user.name for each backend api when available…
parents 970115d0 5da40182
...@@ -38,15 +38,27 @@ angular.module('dgc').factory('lodash', ['$window', ...@@ -38,15 +38,27 @@ angular.module('dgc').factory('lodash', ['$window',
function($window) { function($window) {
return $window.d3; return $window.d3;
} }
]).factory('Global', ['$window', ]).factory('Global', ['$window', '$location',
function($window) { function($window, $location) {
return { return {
user: $window.user, user: $location.search()['user.name'],
authenticated: !!$window.user, authenticated: !!$window.user,
renderErrors: $window.renderErrors renderErrors: $window.renderErrors
}; };
} }
]).run(['$rootScope', 'Global', 'NotificationService', 'lodash', 'd3', function($rootScope, Global, NotificationService, lodash, d3) { ]).factory('HttpInterceptor', ['Global', function(Global) {
return {
'request': function(config) {
if (config.url && (config.url.indexOf('api/atlas/') === 0 || config.url.indexOf('/api/atlas/') === 0)) {
config.params = config.params || {};
config.params['user.name'] = Global.user;
}
return config;
}
};
}]).config(['$httpProvider', function($httpProvider) {
$httpProvider.interceptors.push('HttpInterceptor');
}]).run(['$rootScope', 'Global', 'NotificationService', 'lodash', 'd3', function($rootScope, Global, NotificationService, lodash, d3) {
var errors = Global.renderErrors; var errors = Global.renderErrors;
if (angular.isArray(errors) || angular.isObject(errors)) { if (angular.isArray(errors) || angular.isObject(errors)) {
lodash.forEach(errors, function(err) { lodash.forEach(errors, function(err) {
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
'use strict'; 'use strict';
angular.module('dgc.navigation').factory('NavigationResource', ['$resource', function($resource) { angular.module('dgc.navigation').factory('NavigationResource', ['$resource', function($resource) {
return $resource('api/atlas/types?type=TRAIT', {}, { return $resource('/api/atlas/types?type=TRAIT', {}, {
get: { get: {
'method': 'GET', 'method': 'GET',
'responseType': 'json', 'responseType': 'json',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment