优化已知问题

This commit is contained in:
2025-03-15 16:37:11 +08:00
parent abb9a4dbe7
commit 287ceacaf3
19 changed files with 279 additions and 123 deletions

View File

@@ -1,11 +1,17 @@
import type { UseFetchOptions } from '#app';
import {useToken} from "~/composables/configState";
import {getTenantId} from "~/utils/domain";
export const request = <T>(url:string, options?: UseFetchOptions<T, unknown>) => {
const nuxtApp = useNuxtApp()
const config = useRuntimeConfig()
const TenantId = localStorage.getItem('TenantId') || `${config.public.tenantId}`;
let TenantId = localStorage.getItem('TenantId') || `${config.public.tenantId}`;
const body = options?.body;
// @ts-ignore
const tenantIdByOptions = body?.tenantId;
if(tenantIdByOptions){
// 自定义传TenantId
TenantId = tenantIdByOptions;
}
return useFetch<T>(url,{
baseURL: config.public.apiBaseUrl,
onRequest({ options }: any){