@cocreate/organizations 1.12.0 → 1.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/package.json +1 -1
- package/src/client.js +24 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [1.13.1](https://github.com/CoCreate-app/CoCreate-organizations/compare/v1.13.0...v1.13.1) (2023-05-10)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* setDocumentId ([6e52b99](https://github.com/CoCreate-app/CoCreate-organizations/commit/6e52b99ba52703c89d4ff04bda89eced3ebd01fd))
|
|
7
|
+
|
|
8
|
+
# [1.13.0](https://github.com/CoCreate-app/CoCreate-organizations/compare/v1.12.0...v1.13.0) (2023-05-10)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* form getData and setDocumentId ([5ed4371](https://github.com/CoCreate-app/CoCreate-organizations/commit/5ed4371103578249764add885bcc0cd7e896ab7d))
|
|
14
|
+
|
|
1
15
|
# [1.12.0](https://github.com/CoCreate-app/CoCreate-organizations/compare/v1.11.9...v1.12.0) (2023-05-10)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
package/src/client.js
CHANGED
|
@@ -1,27 +1,41 @@
|
|
|
1
1
|
import crud from '@cocreate/crud-client';
|
|
2
2
|
import indexeddb from '@cocreate/indexeddb';
|
|
3
3
|
import action from '@cocreate/actions';
|
|
4
|
-
import
|
|
4
|
+
import form from '@cocreate/form';
|
|
5
5
|
|
|
6
6
|
const CoCreateOrganization = {
|
|
7
7
|
|
|
8
8
|
createOrg: async function(btn) {
|
|
9
|
-
let
|
|
10
|
-
if (!
|
|
9
|
+
let formEl = btn.closest("form");
|
|
10
|
+
if (!formEl) return;
|
|
11
|
+
|
|
12
|
+
let organization = {
|
|
13
|
+
collection: 'organizations',
|
|
14
|
+
document: [{
|
|
15
|
+
_id: crud.socket.config.organization_id,
|
|
16
|
+
key: crud.socket.config.key
|
|
17
|
+
}]
|
|
18
|
+
}
|
|
19
|
+
let user = {
|
|
20
|
+
collection: 'users',
|
|
21
|
+
document: [{
|
|
22
|
+
_id: crud.socket.config.user_id
|
|
23
|
+
}]
|
|
24
|
+
}
|
|
11
25
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
26
|
+
form.setDocumentId(formEl, organization)
|
|
27
|
+
form.setDocumentId(formEl, user)
|
|
28
|
+
|
|
29
|
+
organization = form.getData(formEl, 'organizations')
|
|
30
|
+
user = form.getData(formEl, 'users')
|
|
31
|
+
|
|
32
|
+
let documents = await indexeddb.generateDB(organization, user)
|
|
16
33
|
|
|
17
34
|
let response = await crud.socket.send('createOrg', {
|
|
18
35
|
documents,
|
|
19
36
|
broadcastBrowser: false
|
|
20
37
|
});
|
|
21
38
|
|
|
22
|
-
setDocumentId(form, organization)
|
|
23
|
-
setDocumentId(form, user)
|
|
24
|
-
|
|
25
39
|
document.dispatchEvent(new CustomEvent('createdOrg', {
|
|
26
40
|
detail: response
|
|
27
41
|
}));
|
|
@@ -107,6 +121,4 @@ action.init({
|
|
|
107
121
|
},
|
|
108
122
|
});
|
|
109
123
|
|
|
110
|
-
CoCreateOrganization.init();
|
|
111
|
-
|
|
112
124
|
export default CoCreateOrganization;
|