|
@@ -2,6 +2,7 @@
|
|
|
// The axios configuration can be changed according to the project, just change the file, other files can be left unchanged
|
|
|
|
|
|
import type { AxiosResponse } from 'axios';
|
|
|
+// import cookie from 'vue-cookie'
|
|
|
import type { RequestOptions, Result } from '/#/axios';
|
|
|
import type { AxiosTransform, CreateAxiosOptions } from './axiosTransform';
|
|
|
import { VAxios } from './Axios';
|
|
@@ -10,7 +11,7 @@ import { useGlobSetting } from '/@/hooks/setting';
|
|
|
import { useMessage } from '/@/hooks/web/useMessage';
|
|
|
import { RequestEnum, ResultEnum, ContentTypeEnum } from '/@/enums/httpEnum';
|
|
|
import { isString } from '/@/utils/is';
|
|
|
-import { getToken } from '/@/utils/auth';
|
|
|
+// import { getToken } from '/@/utils/auth';
|
|
|
import { setObjToUrlParams, deepMerge } from '/@/utils';
|
|
|
import { useErrorLogStoreWithOut } from '/@/store/modules/errorLog';
|
|
|
import { useI18n } from '/@/hooks/web/useI18n';
|
|
@@ -136,7 +137,19 @@ const transform: AxiosTransform = {
|
|
|
*/
|
|
|
requestInterceptors: (config, options) => {
|
|
|
// 请求之前处理config
|
|
|
- const token = getToken();
|
|
|
+ const token = getcookie('token')
|
|
|
+ //获取cookie
|
|
|
+ function getcookie(name){
|
|
|
+ var myname = name + "=";
|
|
|
+ var ca = document.cookie.split(";");
|
|
|
+ for(var i = 0; i<ca.length; i++){
|
|
|
+ var c = ca[i].trim();//去掉字符串首尾空格。
|
|
|
+ if(c.indexOf(myname) == 0){
|
|
|
+ return c.substring(myname.length,c.length);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return "";
|
|
|
+ };
|
|
|
console.log('getToken',token)
|
|
|
if (token && (config as Recordable)?.requestOptions?.withToken !== false) {
|
|
|
// jwt token
|