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