Commit 165455ea845de0dda56ab3ac708991c640aa86be
1 parent
b76e3338
解决token失效 ,登录页面重复跳转登录页面问题
Showing
1 changed file
with
4 additions
and
6 deletions
ant-design-vue-jeecg/src/utils/request.js
@@ -32,13 +32,9 @@ const err = (error) => { | @@ -32,13 +32,9 @@ const err = (error) => { | ||
32 | notification.error({ message: '系统提示', description: '拒绝访问',duration: 4}) | 32 | notification.error({ message: '系统提示', description: '拒绝访问',duration: 4}) |
33 | break | 33 | break |
34 | case 500: | 34 | case 500: |
35 | - let path = window.location.href | ||
36 | //notification.error({ message: '系统提示', description:'Token失效,请重新登录!',duration: 4}) | 35 | //notification.error({ message: '系统提示', description:'Token失效,请重新登录!',duration: 4}) |
37 | - if(token && data.message.includes("Token失效") && path.indexOf('/user/login') < 0){ | 36 | + if(token && data.message.includes("Token失效")){ |
38 | // update-begin- --- author:scott ------ date:20190225 ---- for:Token失效采用弹框模式,不直接跳转---- | 37 | // update-begin- --- author:scott ------ date:20190225 ---- for:Token失效采用弹框模式,不直接跳转---- |
39 | - // store.dispatch('Logout').then(() => { | ||
40 | - // window.location.reload() | ||
41 | - // }) | ||
42 | Modal.error({ | 38 | Modal.error({ |
43 | title: '登录已过期', | 39 | title: '登录已过期', |
44 | content: '很抱歉,登录已过期,请重新登录', | 40 | content: '很抱歉,登录已过期,请重新登录', |
@@ -48,7 +44,9 @@ const err = (error) => { | @@ -48,7 +44,9 @@ const err = (error) => { | ||
48 | store.dispatch('Logout').then(() => { | 44 | store.dispatch('Logout').then(() => { |
49 | Vue.ls.remove(ACCESS_TOKEN) | 45 | Vue.ls.remove(ACCESS_TOKEN) |
50 | try { | 46 | try { |
51 | - if(path.indexOf('/user/login')==-1){ | 47 | + let path = window.document.location.pathname |
48 | + console.log("location pathname -> "+path) | ||
49 | + if(path!="/" && path.indexOf('/user/login')==-1){ | ||
52 | window.location.reload() | 50 | window.location.reload() |
53 | } | 51 | } |
54 | }catch (e) { | 52 | }catch (e) { |