2019-09-07 21:54:44 +02:00
|
|
|
import html from 'choo/html';
|
|
|
|
|
|
|
|
import { HomeController } from './controller'; // The controller for this view, where processing should happen.
|
2019-09-14 06:43:07 +02:00
|
|
|
import { loggedOutView } from './loggedOut';
|
2019-10-18 04:56:57 +02:00
|
|
|
import { loggedInView } from './loggedIn';
|
2019-09-07 21:54:44 +02:00
|
|
|
|
|
|
|
// This is the view function that is exported and used in the view manager.
|
2019-09-16 20:32:53 +02:00
|
|
|
export const homeView = (state, emit, i18n) => {
|
|
|
|
const controller = new HomeController(state, i18n);
|
2019-09-07 21:54:44 +02:00
|
|
|
|
|
|
|
// 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 [
|
2019-09-14 06:43:07 +02:00
|
|
|
(!controller.isLoggedIn
|
|
|
|
? loggedOutView(controller, emit)
|
2019-10-18 04:56:57 +02:00
|
|
|
: loggedInView(controller, emit)
|
2019-09-14 06:43:07 +02:00
|
|
|
),
|
2019-09-07 21:54:44 +02:00
|
|
|
];
|
|
|
|
}
|