mirror of
https://github.com/flarum/framework.git
synced 2025-05-23 07:09:57 +08:00
Massive JavaScript cleanup
- Use JSX for templates - Docblock/comment everything - Mostly passes ESLint (still some work to do) - Lots of renaming, refactoring, etc. CSS hasn't been updated yet.
This commit is contained in:
@ -1,9 +1,17 @@
|
||||
export default function(app) {
|
||||
app.store.pushPayload({data: app.preload.data});
|
||||
app.forum = app.store.getById('forums', 1);
|
||||
import Session from 'flarum/Session';
|
||||
|
||||
if (app.preload.session) {
|
||||
app.session.token(app.preload.session.token);
|
||||
app.session.user(app.store.getById('users', app.preload.session.userId));
|
||||
}
|
||||
/**
|
||||
* The `session` initializer creates the application session and preloads it
|
||||
* with data that has been set on the application's `preload` property.
|
||||
*
|
||||
* `app.preload.session` should be the same as the response from the /api/token
|
||||
* endpoint: it should contain `token` and `userId` keys.
|
||||
*
|
||||
* @param {App} app
|
||||
*/
|
||||
export default function session(app) {
|
||||
app.session = new Session(
|
||||
app.preload.session.token,
|
||||
app.store.getById('users', app.preload.session.userId)
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user