LiteSun commented on code in PR #3076:
URL: https://github.com/apache/apisix-dashboard/pull/3076#discussion_r2103635342


##########
src/apis/routes.ts:
##########
@@ -43,12 +43,14 @@ export const postRouteReq = (req: AxiosInstance, data: 
RoutePostType) =>
   req.post<unknown, APISIXType['RespRouteDetail']>(API_ROUTES, data);
 
 export const deleteAllRoutes = async (req: AxiosInstance) => {
-  const res = await getRouteListReq(req, {
-    page: 1,
-    page_size: 1000,
-  });
-  if (res.total === 0) return;
-  return await Promise.all(
-    res.list.map((d) => req.delete(`${API_ROUTES}/${d.value.id}`))
-  );
+  while (true) {

Review Comment:
   It’s better to retrieve the total count in the first request, and then 
perform the deletion based on that total number.



##########
src/apis/services.ts:
##########
@@ -50,3 +50,16 @@ export const postServiceReq = (req: AxiosInstance, data: 
ServicePostType) =>
     API_SERVICES,
     data
   );
+
+export const deleteAllServices = async (req: AxiosInstance) => {
+  while (true) {

Review Comment:
   ditto



-- 
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