Noded/frontend#84 - make welcome page redirect to SPA by default
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing

This commit is contained in:
Garrett Mills 2021-02-15 19:06:51 -06:00
parent 33944c1b86
commit bebdd504dd
Signed by: garrettmills
GPG Key ID: D2BF5FBA8298F246
3 changed files with 13 additions and 11 deletions

View File

@ -15,17 +15,7 @@ class Home extends Controller {
* Serve the main welcome page. * Serve the main welcome page.
*/ */
welcome(req, res) { welcome(req, res) {
if (req.user) { return res.redirect('/i')
// If we have a user, redirect them to the main app
return res.redirect('/i')
}
/*
* Return the welcome view.
* The page() method is added by Flitter and passes some
* helpful contextual data to the view as well.
*/
return res.page('welcome', { user: req.user });
} }
async get_login(req, res) { async get_login(req, res) {

View File

@ -167,6 +167,11 @@ class Page extends Controller {
return res.api(return_nodes) return res.api(return_nodes)
} }
async get_node(req, res) {
let { page, node } = req.form
return res.api(node)
}
async save_node_to_page(req, res) { async save_node_to_page(req, res) {
const { page } = req.form const { page } = req.form

View File

@ -24,6 +24,13 @@ module.exports = exports = {
['middleware::api:DataInjection', { access_level: 'view' }], ['middleware::api:DataInjection', { access_level: 'view' }],
'controller::api:v1:Page.get_nodes', 'controller::api:v1:Page.get_nodes',
], ],
// Get a particular node present on the specified page
'/:PageId/nodes/:NodeId': [
'middleware::auth:ApiRoute',
['middleware::api:DataInjection', { access_level: 'view' }],
'controller::api:v1:Page.get_node',
],
}, },
post: { post: {