react-query-lightbase-codegen 2.0.7 → 2.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -128,7 +128,7 @@ function generateAxiosMethod(operation, spec) {
|
|
|
128
128
|
.join("\n ");
|
|
129
129
|
return `
|
|
130
130
|
${jsDocLines.join("\n ")}
|
|
131
|
-
export function ${(0, utils_1.camelCase)(operationId)}(data${hasData ? `: ${dataType}` : "?: undefined"}, config?: AxiosRequestConfig): Promise
|
|
131
|
+
export async function ${(0, utils_1.camelCase)(operationId)}(data${hasData ? `: ${dataType}` : "?: undefined"}, config?: AxiosRequestConfig): Promise<${responseType}> {
|
|
132
132
|
${methodBody}
|
|
133
133
|
}`;
|
|
134
134
|
}
|
|
@@ -37,10 +37,7 @@ export const ${namedQueryOptions} = (
|
|
|
37
37
|
const enabled = ${hasData ? `hasDefinedProps(params, ${requiredParams.join(", ")})` : "true"};
|
|
38
38
|
return queryOptions({
|
|
39
39
|
queryKey: ['${(0, utils_1.camelCase)(operationId)}', ${hasData ? "params" : "undefined"}],
|
|
40
|
-
queryFn: enabled ?
|
|
41
|
-
const response = await apiClient.${namedQuery}(${hasData ? "params" : "undefined"}, config);
|
|
42
|
-
return response.data;
|
|
43
|
-
} : skipToken,
|
|
40
|
+
queryFn: enabled ? () => apiClient.${namedQuery}(${hasData ? "params" : "undefined"}, config) : skipToken,
|
|
44
41
|
});
|
|
45
42
|
};`;
|
|
46
43
|
}
|
package/package.json
CHANGED
|
@@ -155,7 +155,7 @@ function generateAxiosMethod(operation: OperationInfo, spec: OpenAPIV3.Document)
|
|
|
155
155
|
|
|
156
156
|
return `
|
|
157
157
|
${jsDocLines.join("\n ")}
|
|
158
|
-
export function ${camelCase(operationId)}(data${hasData ? `: ${dataType}` : "?: undefined"}, config?: AxiosRequestConfig): Promise
|
|
158
|
+
export async function ${camelCase(operationId)}(data${hasData ? `: ${dataType}` : "?: undefined"}, config?: AxiosRequestConfig): Promise<${responseType}> {
|
|
159
159
|
${methodBody}
|
|
160
160
|
}`;
|
|
161
161
|
}
|
|
@@ -45,10 +45,7 @@ export const ${namedQueryOptions} = (
|
|
|
45
45
|
const enabled = ${hasData ? `hasDefinedProps(params, ${requiredParams.join(", ")})` : "true"};
|
|
46
46
|
return queryOptions({
|
|
47
47
|
queryKey: ['${camelCase(operationId)}', ${hasData ? "params" : "undefined"}],
|
|
48
|
-
queryFn: enabled ?
|
|
49
|
-
const response = await apiClient.${namedQuery}(${hasData ? "params" : "undefined"}, config);
|
|
50
|
-
return response.data;
|
|
51
|
-
} : skipToken,
|
|
48
|
+
queryFn: enabled ? () => apiClient.${namedQuery}(${hasData ? "params" : "undefined"}, config) : skipToken,
|
|
52
49
|
});
|
|
53
50
|
};`;
|
|
54
51
|
}
|