优化已知问题
This commit is contained in:
@@ -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){
|
||||
|
||||
Reference in New Issue
Block a user