Restrict menu items based on game stage

This commit is contained in:
2020-11-08 10:51:08 -06:00
parent 79b928c775
commit 7cd399db07
4 changed files with 29 additions and 0 deletions

View File

@@ -7,6 +7,9 @@ const { Controller } = require('libflitter')
* are used as handlers for routes specified in the route files.
*/
class Home extends Controller {
static get services() {
return [...super.services, 'sports_data']
}
/*
* Serve the main welcome page.
@@ -18,6 +21,15 @@ class Home extends Controller {
return res.redirect('/auth/login')
}
}
async get_status(req, res, next) {
return res.api({
team_id: req.user_team.id,
team_name: req.user_team.team_name,
current_week: await this.sports_data.current_play_week(),
is_draft_stage: await this.sports_data.is_draft_stage(),
})
}
}
module.exports = Home