You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
CoreID/app/controllers/Home.controller.js

41 lines
1.1 KiB

const Controller = require('libflitter/controller/Controller')
/*
* Home Controller
* -------------------------------------------------------------
* Controller for the main homepage of this Flitter app. Methods here
* are used as handlers for routes specified in the route files.
*/
class Home extends Controller {
static get services() {
return [...super.services, 'Vue', 'models']
}
/*
* Serve the main welcome page.
*/
async welcome(req, res){
const Setting = this.models.get('Setting')
if ( await Setting.get('home.allow_landing') && !(req.user && await Setting.get('home.redirect_authenticated')) ) {
return res.page('welcome', {
user: req.user,
...this.Vue.data(),
})
}
return res.redirect('/dash')
}
async tmpl(req, res) {
return res.page('tmpl', {...this.Vue.data(), ...this.Vue.session(req)})
}
async log_front_end_error(req, res, next) {
const FrontEndError = this.models.get('FrontEndError')
await FrontEndError.log(req)
return res.api()
}
}
module.exports = Home