Preload session as the last step in initialisation before boot

Can’t remember why…
This commit is contained in:
Toby Zerner 2015-05-02 08:18:45 +09:30
parent 347a595d7a
commit 5d4d031f59
3 changed files with 5 additions and 6 deletions

View File

@ -10,11 +10,11 @@ import boot from 'flarum/initializers/boot';
var app = new App();
app.initializers.add('store', store);
app.initializers.add('preload', preload);
app.initializers.add('session', session);
app.initializers.add('routes', routes);
app.initializers.add('components', components);
app.initializers.add('timestamps', timestamps);
app.initializers.add('preload', preload, {last: true});
app.initializers.add('boot', boot, {last: true});
export default app;

View File

@ -2,4 +2,8 @@ export default function(app) {
if (app.preload.data) {
app.store.pushPayload({data: app.preload.data});
}
if (app.preload.session) {
app.session.token(app.preload.session.token);
app.session.user(app.store.getById('users', app.preload.session.userId));
}
};

View File

@ -2,9 +2,4 @@ import Session from 'flarum/session';
export default function(app) {
app.session = new Session();
if (app.preload.session) {
app.session.token(app.preload.session.token);
app.session.user(app.store.getById('users', app.preload.session.userId));
}
}