Matteo Scandolo | 889ced3 | 2015-11-04 16:07:09 +0100 | [diff] [blame] | 1 | (function() { |
| 2 | 'use strict'; |
Matteo Scandolo | 89b179c | 2016-03-24 11:38:50 -0700 | [diff] [blame] | 3 | console.log('XOS Helpers Module') |
Matteo Scandolo | 32f8392 | 2016-02-11 09:35:29 -0800 | [diff] [blame] | 4 | angular.module('bugSnag', []).factory('$exceptionHandler', function () { |
| 5 | return function (exception, cause) { |
Matteo Scandolo | 6b7054c | 2016-02-25 09:17:07 -0800 | [diff] [blame] | 6 | if( window.Bugsnag ){ |
| 7 | Bugsnag.notifyException(exception, {diagnostics:{cause: cause}}); |
| 8 | } |
| 9 | else{ |
| 10 | console.error(exception, cause, exception.stack); |
| 11 | } |
Matteo Scandolo | 32f8392 | 2016-02-11 09:35:29 -0800 | [diff] [blame] | 12 | }; |
| 13 | }); |
| 14 | |
Matteo Scandolo | 889ced3 | 2015-11-04 16:07:09 +0100 | [diff] [blame] | 15 | angular |
| 16 | .module('xos.helpers',[ |
Matteo Scandolo | 6328d9b | 2015-11-05 16:02:11 +0100 | [diff] [blame] | 17 | 'ngCookies', |
Matteo Scandolo | f5ab3ff | 2016-03-24 14:07:49 -0700 | [diff] [blame] | 18 | 'ngResource', |
Matteo Scandolo | 6328d9b | 2015-11-05 16:02:11 +0100 | [diff] [blame] | 19 | 'xos.xos', |
| 20 | 'xos.hpcapi', |
Matteo Scandolo | 32f8392 | 2016-02-11 09:35:29 -0800 | [diff] [blame] | 21 | 'xos.xoslib', |
Matteo Scandolo | 89b179c | 2016-03-24 11:38:50 -0700 | [diff] [blame] | 22 | 'bugSnag', |
Matteo Scandolo | 889ced3 | 2015-11-04 16:07:09 +0100 | [diff] [blame] | 23 | ]) |
| 24 | .config(config); |
| 25 | |
Matteo Scandolo | 89b179c | 2016-03-24 11:38:50 -0700 | [diff] [blame] | 26 | function config($httpProvider, $interpolateProvider, $resourceProvider) { |
Matteo Scandolo | 889ced3 | 2015-11-04 16:07:09 +0100 | [diff] [blame] | 27 | $httpProvider.interceptors.push('SetCSRFToken'); |
| 28 | |
| 29 | $interpolateProvider.startSymbol('{$'); |
| 30 | $interpolateProvider.endSymbol('$}'); |
| 31 | |
| 32 | // NOTE http://www.masnun.com/2013/09/18/django-rest-framework-angularjs-resource-trailing-slash-problem.html |
| 33 | $resourceProvider.defaults.stripTrailingSlashes = false; |
| 34 | } |
| 35 | })(); |