@livequery/client 2.0.7 → 2.0.11
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/build/Collection.js +6 -1
- package/package.json +1 -1
package/build/Collection.js
CHANGED
|
@@ -109,6 +109,7 @@ export class CollectionObservable extends BehaviorSubject {
|
|
|
109
109
|
}))) {
|
|
110
110
|
const item = {
|
|
111
111
|
...payload,
|
|
112
|
+
id: payload.id || payload._id,
|
|
112
113
|
__adding: false,
|
|
113
114
|
__updating: false,
|
|
114
115
|
__removing: false,
|
|
@@ -299,7 +300,11 @@ export class CollectionObservable extends BehaviorSubject {
|
|
|
299
300
|
return { ref, id, collection_ref, index };
|
|
300
301
|
}
|
|
301
302
|
async add(payload) {
|
|
302
|
-
|
|
303
|
+
const r = await this.collection_options.transporter.add(`${this.ref}`, payload);
|
|
304
|
+
if (r.data && r.data.item && !r.data.item.id) {
|
|
305
|
+
r.data.item.id = r.data.item._id;
|
|
306
|
+
}
|
|
307
|
+
return r;
|
|
303
308
|
}
|
|
304
309
|
async update({ id: update_payload_id, ...payload }) {
|
|
305
310
|
const { id, ref } = this.#find_ref_by_id(update_payload_id);
|