mirror of
https://github.com/flarum/framework.git
synced 2024-12-04 16:23:37 +08:00
ab6c03c0cc
- 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.
18 lines
525 B
JavaScript
18 lines
525 B
JavaScript
import Session from 'flarum/Session';
|
|
|
|
/**
|
|
* 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)
|
|
);
|
|
}
|