feat: request && login && router【e6939e22】(login.vue 和 request.ts 增加租户的选择)

This commit is contained in:
YunaiV
2025-03-20 23:12:55 +08:00
parent 3c3886e345
commit c2358e2132
7 changed files with 113 additions and 35 deletions

View File

@@ -19,7 +19,7 @@ import { useAuthStore } from '#/store';
import { refreshTokenApi } from './core';
const { apiURL } = useAppConfig(import.meta.env, import.meta.env.PROD);
const { apiURL, tenantEnable } = useAppConfig(import.meta.env, import.meta.env.PROD);
function createRequestClient(baseURL: string, options?: RequestClientOptions) {
const client = new RequestClient({
@@ -67,10 +67,7 @@ function createRequestClient(baseURL: string, options?: RequestClientOptions) {
config.headers.Authorization = formatToken(accessStore.accessToken);
config.headers['Accept-Language'] = preferences.app.locale;
config.headers['tenant-id'] = 1
// TODO @芋艿:优化一下
// config.headers['tenant-id'] =
// tenantEnable && tenantId ? tenantId : undefined;
config.headers['tenant-id'] = tenantEnable ? accessStore.tenantId : undefined;
return config;
},
});