@cocreate/organizations 1.13.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 CHANGED
@@ -1,3 +1,10 @@
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
+
1
8
  # [1.13.0](https://github.com/CoCreate-app/CoCreate-organizations/compare/v1.12.0...v1.13.0) (2023-05-10)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/organizations",
3
- "version": "1.13.0",
3
+ "version": "1.13.1",
4
4
  "description": "A simple organizations component in vanilla javascript. Easily configured using HTML5 attributes and/or JavaScript API.",
5
5
  "keywords": [
6
6
  "organizations",
package/src/client.js CHANGED
@@ -9,19 +9,33 @@ const CoCreateOrganization = {
9
9
  let formEl = btn.closest("form");
10
10
  if (!formEl) return;
11
11
 
12
- let organization = form.getData(formEl, 'organizations')
13
- let user = form.getData(formEl, 'users')
14
-
15
- let documents = indexeddb.generateDB(organization, user)
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
+ }
25
+
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
- form.setDocumentId(formEl, organization)
23
- form.setDocumentId(formEl, user)
24
-
25
39
  document.dispatchEvent(new CustomEvent('createdOrg', {
26
40
  detail: response
27
41
  }));