refactor(tenant): 优化租户相关代码

This commit is contained in:
2025-07-16 22:41:56 +08:00
parent 112c27e49c
commit 87bcf33940
10 changed files with 69 additions and 200 deletions

View File

@@ -52,17 +52,14 @@ const handleError = (msg: string) => {
http.interceptors.request.use(
(config: AxiosRequestConfig) => {
const token = getToken()
if (!config.headers) {
config.headers = {}
}
if (token) {
if (!config.headers) {
config.headers = {}
}
config.headers.Authorization = `Bearer ${token}`
}
const tenantId = getTenantId()
if (tenantId) {
if (!config.headers) {
config.headers = {}
}
config.headers['X-Tenant-Id'] = tenantId
}
return config