I need to query from the store before the application boots and I want to use the app.deferReadiness() and app.advanceReadiness(). I’d like to use the store because it gets returned in json api format and i’d rather use ember data for this instead of writing a jquery.ajax call.
I’ve tried app.lookup and container.lookup and this function does not exist. Will I have to resort to private methods to make this happen?
I basically need to do the following:
export function initialize(container, app) {
app.deferReadiness();
/**
* console.log(container.lookup); // undefined
* console.log(app.lookup); // undefined
*/
const store = container.lookup('store:main');
store.findRecord('config', '105-1').then(data => {
// handle stuff
app.advanceReadiness();
}).catch(err => {
// handle error
app.advanceReadiness();
});
}
export default {
name: 'my-initializer',
after: 'store',
initialize
};