From c7095ed481fd30f245dd066c764df4b79a534729 Mon Sep 17 00:00:00 2001 From: Vishesh 'ironeagle' Bangotra Date: Thu, 2 Apr 2026 21:25:12 +0530 Subject: [PATCH] ts-ignore --- src_generic/configuration.ts | 2 +- src_generic/hooks/useResource.ts | 5 +++++ src_generic/{utils => types}/overrides.ts | 0 src_generic/utils/openapi_loader.ts | 10 +++++++--- 4 files changed, 13 insertions(+), 4 deletions(-) rename src_generic/{utils => types}/overrides.ts (100%) diff --git a/src_generic/configuration.ts b/src_generic/configuration.ts index 9609ebb..c22d2cd 100644 --- a/src_generic/configuration.ts +++ b/src_generic/configuration.ts @@ -1,4 +1,4 @@ -import { ResourceOverride } from "./utils/overrides"; +import { ResourceOverride } from "./types/overrides"; export const configuration: Record = { expenses: { diff --git a/src_generic/hooks/useResource.ts b/src_generic/hooks/useResource.ts index c732db6..2fad529 100644 --- a/src_generic/hooks/useResource.ts +++ b/src_generic/hooks/useResource.ts @@ -11,6 +11,7 @@ export function useResource(config: ResourceConfig) { useQuery({ queryKey: [name, "list", params], queryFn: async () => { + // @ts-ignore const res = await api.get(endpoint, { params }); return res.data; } @@ -22,6 +23,7 @@ export function useResource(config: ResourceConfig) { queryKey: [name, "detail", id], queryFn: async () => { if (!id) return null; + // @ts-ignore const res = await api.get(`${endpoint}/${id}`); return res.data; }, @@ -32,6 +34,7 @@ export function useResource(config: ResourceConfig) { const useCreate = () => useMutation({ mutationFn: async (data: Partial) => { + // @ts-ignore const res = await api.post(endpoint, data); return res.data; }, @@ -44,6 +47,7 @@ export function useResource(config: ResourceConfig) { const useUpdate = () => useMutation({ mutationFn: async ({ id, data }: { id: string; data: Partial }) => { + // @ts-ignore const res = await api.put(`${endpoint}/${id}`, data); return res.data; }, @@ -71,6 +75,7 @@ export function useResource(config: ResourceConfig) { const getListQueryOptions = (params?: any) => ({ queryKey: [name, "list", params], queryFn: async () => { + // @ts-ignore const res = await api.get(endpoint, { params }); return res.data; }, diff --git a/src_generic/utils/overrides.ts b/src_generic/types/overrides.ts similarity index 100% rename from src_generic/utils/overrides.ts rename to src_generic/types/overrides.ts diff --git a/src_generic/utils/openapi_loader.ts b/src_generic/utils/openapi_loader.ts index 9572bbc..f12fd61 100644 --- a/src_generic/utils/openapi_loader.ts +++ b/src_generic/utils/openapi_loader.ts @@ -127,6 +127,7 @@ export async function loadConfigFromOpenApi(baseUrl: string): Promise const listOp = paths[listPath]?.get; if (!listOp) continue; + // @ts-ignore const responseSchema = listOp.responses?.["200"]?.content?.["application/json"]?.schema; let schemaObj = responseSchema; if (responseSchema?.type === "array" && responseSchema.items) { @@ -161,10 +162,13 @@ export async function loadConfigFromOpenApi(baseUrl: string): Promise }); } + // @ts-ignore + const serverBaseUrl = import.meta.env.VITE_API_BASE_URL || (api.servers?.[0]?.url ?? "") + // @ts-ignore + const authBaseUrl = import.meta.env.VITE_AUTH_BASE_URL || "" return { - baseUrl: - import.meta.env.VITE_API_BASE_URL || (api.servers?.[0]?.url ?? ""), - authBaseUrl: import.meta.env.VITE_AUTH_BASE_URL || "", + baseUrl: serverBaseUrl, + authBaseUrl: authBaseUrl, resources, }; }