Przeglądaj źródła

响应拦截器判断302跳转到登录页面

seimin 3 lat temu
rodzic
commit
564e8b87d2
1 zmienionych plików z 5 dodań i 3 usunięć
  1. 5 3
      assets/js/config.router.js

+ 5 - 3
assets/js/config.router.js

@@ -20,9 +20,11 @@ app.config(['$authProvider', '$httpProvider', '$stateProvider', '$urlRouterProvi
20
                     },
20
                     },
21
                     response: function (resp) {
21
                     response: function (resp) {
22
                         $injector.invoke([
22
                         $injector.invoke([
23
-                            '$http',
24
-                            function ($http) {
25
-                                // console.log(resp);
23
+                            '$http','$state',
24
+                            function ($http,$state) {
25
+                                if(resp.status == 302){
26
+                                    $state.go('login.signin');
27
+                                }
26
                             }
28
                             }
27
                         ]);
29
                         ]);
28
                         return resp;
30
                         return resp;