Added config to library
diff --git a/xos/core/xoslib/ngXosLib/generator-xos/app/templates/src/js/main.js b/xos/core/xoslib/ngXosLib/generator-xos/app/templates/src/js/main.js
index 9a7bb98..c33c1e6 100644
--- a/xos/core/xoslib/ngXosLib/generator-xos/app/templates/src/js/main.js
+++ b/xos/core/xoslib/ngXosLib/generator-xos/app/templates/src/js/main.js
@@ -15,18 +15,12 @@
'xos.helpers',
'xos.xos'
])
-.config(($interpolateProvider, $routeProvider, $resourceProvider) => {
- $interpolateProvider.startSymbol('{$');
- $interpolateProvider.endSymbol('$}');
-
- // NOTE http://www.masnun.com/2013/09/18/django-rest-framework-angularjs-resource-trailing-slash-problem.html
- $resourceProvider.defaults.stripTrailingSlashes = false;
+.config(($routeProvider) => {
$routeProvider
.when('/', {
template: '<users-list></users-list>',
})
-
.otherwise('/');
})
.config(function($httpProvider){
diff --git a/xos/core/xoslib/ngXosLib/xosHelpers/services/csrfToken.interceptor.js b/xos/core/xoslib/ngXosLib/xosHelpers/services/csrfToken.interceptor.js
new file mode 100644
index 0000000..51f4918
--- /dev/null
+++ b/xos/core/xoslib/ngXosLib/xosHelpers/services/csrfToken.interceptor.js
@@ -0,0 +1,18 @@
+(function() {
+ 'use strict';
+
+ angular
+ .module('xos.helpers')
+ .factory('SetCSRFToken', setCSRFToken);
+
+ function setCSRFToken($cookies) {
+ return {
+ request: function(request){
+ if(request.method !== 'GET'){
+ request.headers['X-CSRFToken'] = $cookies.get('xoscsrftoken');
+ }
+ return request;
+ }
+ };
+ }
+})();
\ No newline at end of file
diff --git a/xos/core/xoslib/ngXosLib/xosHelpers/services/noHyperlinks.interceptor.js b/xos/core/xoslib/ngXosLib/xosHelpers/services/noHyperlinks.interceptor.js
new file mode 100644
index 0000000..6059f99
--- /dev/null
+++ b/xos/core/xoslib/ngXosLib/xosHelpers/services/noHyperlinks.interceptor.js
@@ -0,0 +1,18 @@
+(function() {
+ 'use strict';
+
+ angular
+ .module('xos.helpers')
+ .factory('NoHyperlinks', noHyperlinks);
+
+ function noHyperlinks() {
+ return {
+ request: function(request){
+ if(request.url.indexOf('.html') === -1){
+ request.url += '?no_hyperlinks=1';
+ }
+ return request;
+ }
+ };
+ }
+})();
\ No newline at end of file
diff --git a/xos/core/xoslib/ngXosLib/xosHelpers/xosHelpers.module.js b/xos/core/xoslib/ngXosLib/xosHelpers/xosHelpers.module.js
new file mode 100644
index 0000000..d35400e
--- /dev/null
+++ b/xos/core/xoslib/ngXosLib/xosHelpers/xosHelpers.module.js
@@ -0,0 +1,19 @@
+(function() {
+ 'use strict';
+
+ angular
+ .module('xos.helpers',[
+ 'ngCookies'
+ ])
+ .config(config);
+
+ function config($httpProvider, $interpolateProvider, $resourceProvider) {
+ $httpProvider.interceptors.push('SetCSRFToken');
+
+ $interpolateProvider.startSymbol('{$');
+ $interpolateProvider.endSymbol('$}');
+
+ // NOTE http://www.masnun.com/2013/09/18/django-rest-framework-angularjs-resource-trailing-slash-problem.html
+ $resourceProvider.defaults.stripTrailingSlashes = false;
+ }
+})();
\ No newline at end of file