Copilot commented on code in PR #3006:
URL: https://github.com/apache/apisix-dashboard/pull/3006#discussion_r2066837705


##########
src/apis/upstreams.ts:
##########
@@ -0,0 +1,21 @@
+import { API_UPSTREAMS } from '@/config/constant';
+import { req } from '@/config/req';
+import type { A6Type } from '@/types/schema/apisix';
+import { queryOptions } from '@tanstack/react-query';
+
+export const getUpstreamReq = (id: string) =>
+  queryOptions({
+    queryKey: ['upstream', id],
+    queryFn: () =>
+      req
+        .get<unknown, A6Type['RespUpstreamDetail']>(`${API_UPSTREAMS}/${id}`)
+        .then((v) => v.data),
+  });
+
+export const putUpstreamReq = (data: A6Type['Upstream']) => {
+  const { id, ...rest } = data;
+  return req.put<A6Type['Upstream'], A6Type['RespGlobalRuleDetail']>(

Review Comment:
   The PUT upstream request response type is defined as 
A6Type['RespGlobalRuleDetail'], which is inconsistent with the GET request 
returning A6Type['RespUpstreamDetail']. This may lead to type mismatches and 
unintended behavior; consider updating the response type for consistency.
   ```suggestion
     return req.put<A6Type['Upstream'], A6Type['RespUpstreamDetail']>(
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@apisix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to