2015-02-24 18:03:18 +08:00
|
|
|
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)) {
|
2015-03-24 12:34:24 +08:00
|
|
|
store.pushPayload({included: FLARUM_DATA});
|
2015-02-24 18:03:18 +08:00
|
|
|
}
|
|
|
|
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
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|