feat: 注册
This commit is contained in:
+3
-4
@@ -6,7 +6,7 @@ import { BASE_URL, Authorization } from '@/utils/config.js'
|
||||
|
||||
function request(options) {
|
||||
const { url, method = 'GET', data = {}, headers = {}, isShowLoading = true } = options;
|
||||
|
||||
|
||||
// const token = uni.getStorageSync(tokenKey); // 获取token, 根据实际情况调整获取方式
|
||||
const token = getStorageFun(TOKEN_NAME); // 获取token, 根据实际情况调整获取方式
|
||||
let defaultHeaders = {
|
||||
@@ -14,10 +14,9 @@ function request(options) {
|
||||
'HSM-AUTH': token ? token : '', // 如果存在token, 则添加到请求头中
|
||||
'content-type': ['post', 'POST'].includes(method) ? 'application/x-www-form-urlencoded' : 'application/json',
|
||||
};
|
||||
if(options.cha){
|
||||
defaultHeaders['content-type']= 'application/json'
|
||||
if (options.cha) {
|
||||
defaultHeaders['content-type'] = 'application/json'
|
||||
}
|
||||
console.log('defaultHeaders',defaultHeaders,method)
|
||||
if (token) {
|
||||
defaultHeaders['HSM-AUTH'] = token;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user