|
|
|
@ -2,7 +2,7 @@
|
|
|
|
|
* @Author: ch
|
|
|
|
|
* @Date: 2022-05-04 17:11:07
|
|
|
|
|
* @LastEditors: ch
|
|
|
|
|
* @LastEditTime: 2022-06-29 11:16:31
|
|
|
|
|
* @LastEditTime: 2022-06-29 16:01:55
|
|
|
|
|
* @Description: file content
|
|
|
|
|
*/
|
|
|
|
|
import { CreateUUID } from "@/plugins/utils";
|
|
|
|
@ -23,14 +23,12 @@ export default function ({$axios, store, route, req}, inject) {
|
|
|
|
|
$axiosTk.defaults.timeout = 3000;
|
|
|
|
|
$axiosTk.onRequest( config =>{
|
|
|
|
|
config.headers.uid = uuid;
|
|
|
|
|
if (config.headers.notVerifyToken) {
|
|
|
|
|
if(!store.state.token){
|
|
|
|
|
location.href = '/';
|
|
|
|
|
return Promise.reject({message : '要先登录才能操作哦~'});
|
|
|
|
|
}
|
|
|
|
|
delete config.headers.notVerifyToken;
|
|
|
|
|
if(!store.state.token && !config.headers.notVerifyToken){
|
|
|
|
|
location.href = '/';
|
|
|
|
|
return Promise.reject({message : '要先登录才能操作哦~'});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
delete config.headers.notVerifyToken;
|
|
|
|
|
config.headers.Authorization = store.state.token;
|
|
|
|
|
return config;
|
|
|
|
|
});
|
|
|
|
|