mirror of
https://github.com/flarum/framework.git
synced 2025-01-19 16:23:16 +08:00
Preload session as the last step in initialisation before boot
Can’t remember why…
This commit is contained in:
parent
347a595d7a
commit
5d4d031f59
|
@ -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;
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user