feat(request): 实现动态Terminal功能。

This commit is contained in:
Ordinary
2024-08-03 10:33:09 +08:00
parent d1681ec2d5
commit c9434b9ec9
2 changed files with 45 additions and 9 deletions
+9 -9
View File
@@ -4,13 +4,12 @@
*/
import Request from 'luch-request';
import { baseUrl, apiPath, tenantId } from '@/sheep/config';
import { apiPath, baseUrl, tenantId } from '@/sheep/config';
import $store from '@/sheep/store';
import $platform from '@/sheep/platform';
import {
showAuthModal
} from '@/sheep/hooks/useModal';
import { showAuthModal } from '@/sheep/hooks/useModal';
import AuthUtil from '@/sheep/api/member/auth';
import { getTerminalEnumByUniPlatform } from '@/sheep/util/const';
const options = {
// 显示操作成功消息 默认不显示
@@ -93,13 +92,14 @@ http.interceptors.request.use(
// 增加 token 令牌、terminal 终端、tenant 租户的请求头
const token = getAccessToken();
if (token) {
config.header['Authorization'] = token;
}
// TODO 芋艿:特殊处理
config.header['Authorization'] = token;
}
const terminalType = uni.getSystemInfoSync().uniPlatform
config.header['terminal'] = getTerminalEnumByUniPlatform(terminalType);
config.header['Accept'] = '*/*';
config.header['tenant-id'] = tenantId;
config.header['terminal'] = '20';
// config.header['Authorization'] = 'Bearer test247';
return config;
},
(error) => {