backend/app/controllers/api/v1/Session.controller.js
garrettmills 273460b126
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing
Add support for fetching session data; add /start url
(Noded/frontend#15)
2020-10-12 20:32:27 -05:00

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