Browse Source

Update collection load

pull/4223/head
Artur Arseniev 5 years ago
parent
commit
93b8ed94a2
  1. 4
      src/common/module.js
  2. 3
      src/css_composer/model/CssRule.js
  3. 2
      src/storage_manager/config/config.js
  4. 2
      src/storage_manager/index.js
  5. 2
      src/storage_manager/model/RemoteStorage.js

4
src/common/module.js

@ -1,5 +1,5 @@
import { isString, isElement } from 'underscore';
import { createId } from 'utils/mixins';
import { createId, isDef } from 'utils/mixins';
export default {
getConfig(name) {
@ -33,7 +33,7 @@ export default {
if (onResult) {
result && onResult(result, opts);
} else if (result && result.length) {
} else if (result && isDef(result.length)) {
coll.reset(result, opts);
}

3
src/css_composer/model/CssRule.js

@ -234,6 +234,9 @@ export default class CssRule extends Model.extend(Styleable) {
}
});
// Delete the property used for partial updates
delete obj.style.__p;
if (isEmpty(obj.selectors)) delete obj.selectors;
if (isEmpty(obj.style)) delete obj.style;
}

2
src/storage_manager/config/config.js

@ -52,7 +52,7 @@ export default {
// You can pass a simple object: { someOption: 'someValue' }
// or a function which returns and object to add:
// currentOpts => {
// return currentOpts.method === 'post' ? { method: 'patch' } : {};
// return currentOpts.method === 'POST' ? { method: 'PATCH' } : {};
// }
fetchOptions: '',

2
src/storage_manager/index.js

@ -218,7 +218,7 @@ export default () => {
const st = this.getCurrentStorage();
const opts = { ...this.getCurrentOptons(), ...options };
const result = await this.__exec(st, opts);
console.log('onLOAD', { opts, result });
return result;
},

2
src/storage_manager/model/RemoteStorage.js

@ -53,7 +53,7 @@ export default class RemoteStorage extends Model {
}
const result = {
method: body ? 'post' : 'get',
method: body ? 'POST' : 'GET',
credentials: opts.credentials,
headers,
body,

Loading…
Cancel
Save