Readlebee/app/views/home/index.js

22 lines
741 B
JavaScript
Raw Normal View History

const html = require('choo/html');
const { HomeController } = require('./controller'); // The controller for this view, where processing should happen.
const { loggedOutView } = require('./loggedOut');
const { loggedInView } = require('./loggedIn');
// This is the view function that is exported and used in the view manager.
const homeView = (state, emit, i18n) => {
const controller = new HomeController(state, i18n);
// Returning an array in a view allows non-shared parent HTML elements.
// This one doesn't have the problem right now, but it's good to remember.
return [
2020-09-22 04:49:02 +02:00
(!controller.isLoggedIn
2019-09-14 06:43:07 +02:00
? loggedOutView(controller, emit)
2019-10-18 04:56:57 +02:00
: loggedInView(controller, emit)
2019-09-14 06:43:07 +02:00
),
];
}
module.exports = { homeView };