blob: c4b40f1540838873c95b32cb9359bb03a893a1b4 [file] [log] [blame]
Matteo Scandolo817386b2015-11-04 16:07:09 +01001(function() {
2 'use strict';
Matteo Scandolo8420f622016-03-24 11:38:50 -07003 console.log('XOS Helpers Module')
Matteo Scandoloba4c9aa2016-02-11 09:35:29 -08004 angular.module('bugSnag', []).factory('$exceptionHandler', function () {
5 return function (exception, cause) {
Matteo Scandoloac21e412016-02-25 09:17:07 -08006 if( window.Bugsnag ){
7 Bugsnag.notifyException(exception, {diagnostics:{cause: cause}});
8 }
9 else{
10 console.error(exception, cause, exception.stack);
11 }
Matteo Scandoloba4c9aa2016-02-11 09:35:29 -080012 };
13 });
14
Matteo Scandolo817386b2015-11-04 16:07:09 +010015 angular
16 .module('xos.helpers',[
Matteo Scandolo3c217ad2015-11-05 16:02:11 +010017 'ngCookies',
Matteo Scandolo061094b2016-03-24 14:07:49 -070018 'ngResource',
Matteo Scandolo3c217ad2015-11-05 16:02:11 +010019 'xos.xos',
20 'xos.hpcapi',
Matteo Scandoloba4c9aa2016-02-11 09:35:29 -080021 'xos.xoslib',
Matteo Scandolo8420f622016-03-24 11:38:50 -070022 'bugSnag',
Matteo Scandolo91fe03d2016-03-24 15:29:52 -070023 'xos.uiComponents'
Matteo Scandolo817386b2015-11-04 16:07:09 +010024 ])
25 .config(config);
26
Matteo Scandolo8420f622016-03-24 11:38:50 -070027 function config($httpProvider, $interpolateProvider, $resourceProvider) {
Matteo Scandolo817386b2015-11-04 16:07:09 +010028 $httpProvider.interceptors.push('SetCSRFToken');
29
30 $interpolateProvider.startSymbol('{$');
31 $interpolateProvider.endSymbol('$}');
32
33 // NOTE http://www.masnun.com/2013/09/18/django-rest-framework-angularjs-resource-trailing-slash-problem.html
34 $resourceProvider.defaults.stripTrailingSlashes = false;
35 }
36})();