@@ -7,53 +7,13 @@ class CoCreateApi {
77
88 async getOrganization ( config , component ) {
99
10- let org = await CRUD . send ( {
11- method : 'object.read' ,
12- array : "organizations" ,
13- key : config [ "key" ] ,
14- organization_id : config [ "organization_id" ] ,
15- object : {
16- _id : config [ "organization_id" ]
17- }
10+ let organization = await this . crud . getOrganization ( config . organization_id ) ;
1811
19- } ) ;
20-
21- if ( ! org || ! org . object && ! org . object [ 0 ] ) {
22- console . log ( component , " Error GET ORG in : " , e ) ;
12+ if ( ! organization . error )
2313 return false ;
24- }
25-
26- return org . object [ 0 ] ;
27- }
28-
29- async getApiKey ( organization_id , name ) {
30- this . organizations [ organization_id ] = this . getOrganization ( organization_id , name )
31- this . organizations [ organization_id ] = await this . organizations [ organization_id ]
32- return this . organizations [ organization_id ]
33- }
34-
35- async getOrganizationNew ( organization_id , name ) {
36- let organization = await this . crud . send ( {
37- method : 'object.read' ,
38- database : organization_id ,
39- array : 'organizations' ,
40- object : [ { _id : organization_id } ] ,
41- organization_id
42- } )
43-
44- if ( organization
45- && organization . object
46- && organization . object [ 0 ] ) {
47- if ( organization . object [ 0 ] . apis && organization . object [ 0 ] . apis [ name ] ) {
48- return organization . object [ 0 ] . apis && organization . object [ 0 ] . apis [ name ]
49- } else
50- return { [ this . name ] : false , error : 'An apikey could not be found' }
51- } else {
52- return { serverOrganization : false , error : 'An organization could not be found' }
53- }
5414
15+ return organization
5516 }
56-
5717}
5818
5919
0 commit comments