Created
May 3, 2019 13:16
-
-
Save samselikoff/682480b6a20ebc96596177799930025d to your computer and use it in GitHub Desktop.
First pass at a LoadRecords component
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Component from '@ember/component'; | |
import { task } from 'ember-concurrency'; | |
import { inject as service } from '@ember/service'; | |
export default Component.extend({ | |
tagName: '', | |
store: service(), | |
didInsertElement() { | |
this._super(...arguments); | |
this.query.perform(); | |
}, | |
query: task(function*() { | |
let params = { ...this.params }; | |
if (this.backgroundReload !== undefined) { | |
params.backgroundReload = this.backgroundReload; | |
} | |
return yield this.store.loadRecords(this.modelName, params); | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment