27 lines
625 B
JavaScript
27 lines
625 B
JavaScript
|
const { Controller } = require('libflitter')
|
||
|
|
||
|
class SessionController extends Controller {
|
||
|
static get services() {
|
||
|
return [...super.services, 'configs']
|
||
|
}
|
||
|
|
||
|
async get_session(req, res, next) {
|
||
|
return res.api(await this.session_data(req.user))
|
||
|
}
|
||
|
|
||
|
async session_data(user) {
|
||
|
return {
|
||
|
user: {
|
||
|
id: user.id,
|
||
|
username: user.uid,
|
||
|
},
|
||
|
app: {
|
||
|
name: this.configs.get('app.name'),
|
||
|
url: this.configs.get('app.url'),
|
||
|
},
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module.exports = exports = SessionController
|