Sfoglia il codice sorgente

修改token过期放回登录

半生瓜 3 mesi fa
parent
commit
4814efe3b3
1 ha cambiato i file con 5 aggiunte e 5 eliminazioni
  1. 5 5
      src/axios/service.ts

+ 5 - 5
src/axios/service.ts

@@ -2,7 +2,7 @@
2 2
  * @Author: 半生瓜 1515706227@qq.com
3 3
  * @Date: 2024-04-21 17:20:21
4 4
  * @LastEditors: 半生瓜 1515706227@qq.com
5
- * @LastEditTime: 2024-05-28 01:10:53
5
+ * @LastEditTime: 2024-05-29 14:15:20
6 6
  * @FilePath: \vue-element-plus-admin-mini\src\axios\service.ts
7 7
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
8 8
  */
@@ -45,8 +45,8 @@ axiosInstance.interceptors.response.use(
45 45
 
46 46
       setTimeout(() => {
47 47
         console.log('daozelllll11112222')
48
-        router.push('/login') // Redirect to login if token is not found
49
-      }, 2000)
48
+        window.location.reload()
49
+      }, 1000)
50 50
     }
51 51
     console.log('er22r: ' + error) // for debug
52 52
     ElMessage.error(error.message)
@@ -74,8 +74,8 @@ const service = {
74 74
 
75 75
           setTimeout(() => {
76 76
             console.log('daozelllll1111')
77
-            router.push('/login') // Redirect to login if token is not found
78
-          }, 2000)
77
+            window.location.reload()
78
+          }, 1000)
79 79
           reject(err)
80 80
         })
81 81
     })