fixes for latest openapi spec changes

This commit is contained in:
2026-05-23 17:22:30 +05:30
parent a1ff2c692c
commit cccb4604fd
3 changed files with 16 additions and 13 deletions

View File

@@ -30,13 +30,13 @@ export function useResource<T = any>(config: ResourceConfig | undefined) {
});
// --- READ ONE ---
const useRead = (id: string | null) =>
const useRead = (id: string, params?: any | null) =>
useQuery({
queryKey: [name, "detail", id],
queryKey: [name, "detail", id, params],
queryFn: async () => {
if (!id || !endpoint) return null;
// @ts-ignore
const res = await api.get<T>(`${endpoint}/${id}`);
const res = await api.get<T>(`${endpoint}/${id}`, params ? { params } : undefined);
return res.data;
},
enabled: !!id && !!endpoint,