Browse Source

fix drop collection not reflected on page

Signed-off-by: ryjiang <jiangruiyi@gmail.com>
ryjiang 1 year ago
parent
commit
0404316577
2 changed files with 4 additions and 2 deletions
  1. 1 1
      client/src/context/Data.tsx
  2. 3 1
      client/src/http/Collection.service.ts

+ 1 - 1
client/src/context/Data.tsx

@@ -225,7 +225,7 @@ export const DataProvider = (props: { children: React.ReactNode }) => {
   const dropCollection = async (name: string) => {
     // drop collection
     const dropped = await CollectionService.dropCollection(name);
-    if (dropped.error_code === 'Success') {
+    if (dropped.data.error_code === 'Success') {
       // remove collection from state
       setCollections(prev => prev.filter(v => v.collection_name !== name));
     }

+ 3 - 1
client/src/http/Collection.service.ts

@@ -33,7 +33,9 @@ export class CollectionService extends BaseModel {
   }
 
   static dropCollection(collectionName: string) {
-    return super.delete<ResStatus>({ path: `/collections/${collectionName}` });
+    return super.delete<{ data: ResStatus }>({
+      path: `/collections/${collectionName}`,
+    });
   }
 
   static loadCollection(collectionName: string, param?: LoadReplicaReq) {