添加未登录非法访问跳转到首页

merge-requests/12/head
ch 3 years ago
parent d17fa25389
commit 79d9ac308b

@ -2,14 +2,15 @@
* @Author: ch
* @Date: 2022-05-04 17:11:07
* @LastEditors: ch
* @LastEditTime: 2022-05-07 23:59:45
* @LastEditTime: 2022-05-10 14:30:24
* @Description: file content
*/
let axiosTk = null;
export default function ({$axios, store}, inject) {
export default function ({$axios, store, route}, inject) {
const $axiosTk = $axios.create();
$axiosTk.onRequest( config =>{
if(!store.state.token){
location.href = '/';
return Promise.reject({message : '要先登录才能操作哦~'});
}
config.headers.Authorization = store.state.token;

Loading…
Cancel
Save