Skip to content

Commit 1e012b3

Browse files
committed
fix: replaced @cocreate/crud-client with @cocreate/elements
1 parent 7c70ed2 commit 1e012b3

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

src/client.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
// For details, visit <https://cocreate.app/licenses/> or contact us at [email protected].
2222

2323
import Observer from '@cocreate/Observer';
24-
import crud from '@cocreate/crud-client';
24+
import Crud from '@cocreate/crud-client';
25+
import Elements from '@cocreate/elements';
2526
import Actions from '@cocreate/Actions';
2627
import render from '@cocreate/render';
2728
import { queryElements } from '@cocreate/utils';
@@ -385,7 +386,7 @@ async function upload(element, data) {
385386
}
386387

387388
for (let input of inputs) {
388-
let Data = crud.getObject(input);
389+
let Data = Elements.getObject(input);
389390
if (Data.type) {
390391
if (input.getFilter)
391392
Data.filter = input.getFilter()
@@ -406,16 +407,16 @@ async function upload(element, data) {
406407
}
407408

408409
let action = 'update' + Data.type.charAt(0).toUpperCase() + Data.type.slice(1)
409-
if (crud[action]) {
410-
let response = await crud[action](Data)({
410+
if (Crud[action]) {
411+
let response = await Crud[action](Data)({
411412
array,
412413
object,
413414
upsert: true
414415
});
415416

416417
data.push(response)
417418
if (response && (!object || object !== response.object)) {
418-
crud.setObjectId(element, array, response.object);
419+
Elements.setTypeValue(element, response);
419420
}
420421
}
421422
}
@@ -467,7 +468,7 @@ async function Import(element, data) {
467468
}
468469

469470
if (element[i].type !== 'file') {
470-
let Data = crud.getObject(element[i]);
471+
let Data = Elements.getObject(element[i]);
471472
if (Data.type) {
472473
if (element[i].getFilter)
473474
Data.filter = element[i].getFilter()
@@ -482,8 +483,8 @@ async function Import(element, data) {
482483
if (data.length) {
483484
for (let i = 0; i < data.length; i++) {
484485
let action = 'create' + data[i].type.charAt(0).toUpperCase() + data[i].type.slice(1)
485-
if (crud[action]) {
486-
data[i] = await crud[action](data[i])
486+
if (Crud[action]) {
487+
data[i] = await Crud[action](data[i])
487488
}
488489
}
489490
}
@@ -519,16 +520,16 @@ async function Export(element, data) {
519520
if (inputs.length)
520521
data.push(...getFiles(inputs))
521522

522-
let Data = crud.getObject(element[i]);
523+
let Data = Elements.getObject(element[i]);
523524
if (Data.type) {
524525
if (element[i].getFilter)
525526
Data.filter = element[i].getFilter()
526527

527528
if (Data.type === 'key')
528529
Data.type = 'object'
529530
let action = 'read' + Data.type.charAt(0).toUpperCase() + Data.type.slice(1)
530-
if (crud[action]) {
531-
Data = await crud[action](Data)
531+
if (Crud[action]) {
532+
Data = await Crud[action](Data)
532533
data.push(...Data[Data.type])
533534
}
534535
}

0 commit comments

Comments
 (0)