Browse Source

fix create action

Kieran Gibb 1 year ago
parent
commit
81bd87eec9
No known key found for this signature in database
2 changed files with 17 additions and 3 deletions
  1. 14
    1
      cobox-cli/bin/groups/create.js
  2. 3
    2
      cobox-cli/bin/groups/join.js

+ 14
- 1
cobox-cli/bin/groups/create.js View File

@@ -17,14 +17,27 @@ exports.builder = {
17 17
     type: 'string',
18 18
     alias: 'n',
19 19
     demandOption: true
20
+  },
21
+  address: {
22
+    description: 'the address of the group',
23
+    type: 'string',
24
+    alias: 'A'
25
+  },
26
+  encryptionKey: {
27
+    description: 'the encryption key of the group',
28
+    type: 'string',
29
+    alias: 'k'
20 30
   }
21 31
 }
22 32
 exports.handler = async function (argv) {
23 33
   var name = argv.name,
24
-    data = { name },
34
+    address = argv.address,
35
+    encryptionKey = argv.encryptionKey,
25 36
     response,
26 37
     group
27 38
 
39
+  var data = { name, address, encryptionKey }
40
+
28 41
   onSuccess('creating a new group...')
29 42
 
30 43
   try {

+ 3
- 2
cobox-cli/bin/groups/join.js View File

@@ -37,11 +37,12 @@ exports.handler = async function (argv) {
37 37
     response = await request.get(`/groups/${id}`, { data })
38 38
     group = response.data
39 39
   } catch (error) {
40
-    var errors = response.errors
40
+    response = error.response
41
+    var errors = response.data.errors
41 42
     onError(errors.map((err) => err.msg))
42 43
   }
43 44
 
44
-  if (!group && !address)  return onError([`replicator does not exist, provide an address.`])
45
+  if (!group && !address) return onError([`group does not exist, provide an address.`])
45 46
 
46 47
   if (!group) {
47 48
     onSuccess('creating a new group...')