修改token

feature/comment-0624-ch
ch 2 years ago
parent 11878e566f
commit c8302cf9ef

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-06-20 11:38:48 * @Date: 2022-06-20 11:38:48
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-06-29 11:55:10 * @LastEditTime: 2022-06-29 16:03:36
* @Description: file content * @Description: file content
*/ */
@ -30,7 +30,11 @@ export const ApiGetCommentList = (params) =>
* @param {*} param0 * @param {*} param0
*/ */
export const ApiGetCommentCount = ({productId}) => export const ApiGetCommentCount = ({productId}) =>
ToAsyncAwait(axios.get(`${BASE_URL}/app/comment/getAllCommentCountByProductId/${productId}`)); ToAsyncAwait(axiosTk.get(`${BASE_URL}/app/comment/getAllCommentCountByProductId/${productId}`,{
params: {
notVerifyToken : true
}
}));
/** /**
* 根据商品获取标签评论总数 * 根据商品获取标签评论总数
* @param {*} param0 * @param {*} param0

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

Loading…
Cancel
Save