You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.3 KiB

  1. 'use strict';
  2. var urlapi = "http://localhost:3030/";
  3. // Declare app level module which depends on views, and components
  4. angular.module('webapp', [
  5. 'ngRoute',
  6. 'ngMessages',
  7. 'angularBootstrapMaterial',
  8. 'toastr',
  9. 'app.navbar',
  10. 'app.main'
  11. ]).
  12. config(['$locationProvider', '$routeProvider', function($locationProvider, $routeProvider) {
  13. $locationProvider.hashPrefix('!');
  14. $routeProvider.otherwise({redirectTo: '/main'});
  15. }])
  16. .config(function(toastrConfig) {
  17. angular.extend(toastrConfig, {
  18. autoDismiss: false,
  19. containerId: 'toast-container',
  20. maxOpened: 0,
  21. newestOnTop: true,
  22. positionClass: 'toast-bottom-right',
  23. preventDuplicates: false,
  24. preventOpenDuplicates: false,
  25. target: 'body'
  26. });
  27. })
  28. .factory('httpInterceptor', function httpInterceptor () {
  29. return {
  30. request: function(config) {
  31. return config;
  32. },
  33. requestError: function(config) {
  34. return config;
  35. },
  36. response: function(res) {
  37. return res;
  38. },
  39. responseError: function(res) {
  40. return res;
  41. }
  42. };
  43. })
  44. .factory('api', function ($http) {
  45. return {
  46. init: function () {
  47. /*$http.defaults.headers.common['X-Access-Token'] = localStorage.getItem('cr_webapp_token');
  48. $http.defaults.headers.post['X-Access-Token'] = localStorage.getItem('cr_webapp_token');*/
  49. }
  50. };
  51. })
  52. .run(function (api) {
  53. api.init();
  54. });