Browse Source

拦截验证方式微调

hejq 7 years ago
parent
commit
6fc7f7d3e6
1 changed files with 4 additions and 3 deletions
  1. 4 3
      src/main/webapp/resources/js/index/app.js

+ 4 - 3
src/main/webapp/resources/js/index/app.js

@@ -7,12 +7,13 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
     app.config(['$httpProvider', function ($httpProvider) {
         // http拦截
         $httpProvider.interceptors.push('httpInterceptor');
+
     }]);
-    app.factory('httpInterceptor', ['$window', '$q', 'SessionService', function ($window, $q, SessionService) {
+    app.factory('httpInterceptor', ['$window', '$q', function ($window, $q) {
+        var session = $window.sessionStorage;
         var httpInterceptor = {
             'responseError': function (response) {
-                var authorized = SessionService.get('authenticated');
-                if (!authorized) {
+                if (!session.authenticated) {
                     if (response.status == 401) {// UNAUTHORIZED
                         // window.location.href = response.data.loginUrl || 'index';
                         // window.location.href = window.location.origin + window.location.pathname + '/login';