mirror of
https://github.com/flarum/framework.git
synced 2024-12-12 14:13:37 +08:00
a62e04f956
Note: npm source for ember-json-api changed to a fork, but I still had to apply a custom change to get polymorphic relationships to work (see https://github.com/kurko/ember-json-api/pull/71#issuecomment-85257281)
21 lines
588 B
JavaScript
21 lines
588 B
JavaScript
import Ember from 'ember';
|
|
|
|
export default {
|
|
name: 'preload-data',
|
|
after: 'store',
|
|
initialize: function(container) {
|
|
var store = container.lookup('store:main');
|
|
if (!Ember.isEmpty(FLARUM_DATA)) {
|
|
store.pushPayload({included: FLARUM_DATA});
|
|
}
|
|
if (!Ember.isEmpty(FLARUM_SESSION)) {
|
|
FLARUM_SESSION.user = store.getById('user', FLARUM_SESSION.userId);
|
|
container.lookup('simple-auth-session:main').setProperties({
|
|
isAuthenticated: true,
|
|
authenticator: 'authenticator:flarum',
|
|
content: FLARUM_SESSION
|
|
});
|
|
}
|
|
}
|
|
};
|