This is an automated email from the ASF dual-hosted git repository.

zakwu pushed a commit to branch new-web-client
in repository https://gitbox.apache.org/repos/asf/incubator-tubemq.git


The following commit(s) were added to refs/heads/new-web-client by this push:
     new 20ec601  fix(request): request data handle
20ec601 is described below

commit 20ec6011c59f1f0052aeb9cc67b09e2184d361f7
Author: zakwu <123537...@qq.com>
AuthorDate: Tue Jun 30 17:27:17 2020 +0800

    fix(request): request data handle
---
 web/src/hooks/index.ts | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/web/src/hooks/index.ts b/web/src/hooks/index.ts
index 488569c..8340c9e 100644
--- a/web/src/hooks/index.ts
+++ b/web/src/hooks/index.ts
@@ -32,14 +32,18 @@ axios.interceptors.response.use(
       return Promise.reject(data);
     }
 
-    // set object outside data into it
-    const res = Object.assign({}, data);
-    delete res.errCode;
-    delete res.errMsg;
-    res.data = Object.assign(res.data, {
-      ...res,
-    });
-    return res || [];
+    // admin_query_master_group_info interface design no good need handle
+    if (
+      Object.keys(data).includes('groupName') &&
+      Object.keys(data).includes('groupStatus')
+    ) {
+      data.data = {
+        data: data.data,
+        groupName: data.groupName,
+        groupStatus: data.groupStatus,
+      };
+    }
+    return data || [];
   },
   function(error) {
     return Promise.reject(error);

Reply via email to