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.

63 lines
1.7 KiB

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