router: change order of arguments

fixup! freeze state & rename app ns to location
This commit is contained in:
Yoshua Wuyts
2016-07-02 22:54:35 +02:00
parent c679e37d3a
commit 6407188ee9
15 changed files with 85 additions and 50 deletions
+2 -1
View File
@@ -1,7 +1,8 @@
const dateformat = require('dateformat')
const html = require('../../../html')
module.exports = function (params, state, send) {
module.exports = function (state, prev, send) {
const params = state.params
const mailbox = params.mailbox
const messages = state[mailbox].messages
return html`
+2 -1
View File
@@ -1,6 +1,7 @@
const html = require('../../../html')
module.exports = function (params, state, send) {
module.exports = function (state, prev, send) {
const params = state.params
const mailbox = params.mailbox
const message = params.message
+1 -1
View File
@@ -1,6 +1,6 @@
const html = require('../../../html')
module.exports = function (params, state, send) {
module.exports = function (state, prev, send) {
return html`
<section>
<p>Select a mailbox</p>
+2 -1
View File
@@ -2,7 +2,8 @@ const dateformat = require('dateformat')
const html = require('../../../html')
module.exports = function () {
return function (params, state, send) {
return function (state, prev, send) {
const params = state.params
const mailbox = params.mailbox
const message = params.message
const messages = state[mailbox].messages
+1 -1
View File
@@ -2,7 +2,7 @@ const html = require('../../../html')
const mailboxes = [ 'inbox', 'spam', 'sent' ]
module.exports = function (params, state, send) {
module.exports = function (state, prev, send) {
return html`
<aside class="fl mt4 w-20 db">
<ul>
+2 -2
View File
@@ -1,8 +1,8 @@
const pathname = require('pathname-match')
const html = require('../../../html')
module.exports = function (params, state, send) {
const location = state.app.location
module.exports = function (state, prev, send) {
const location = state.location.pathname
return html`
<span class="fl mt4 w-100 f4 b">
URL: ${pathname(location) || '/'}
+5 -5
View File
@@ -5,14 +5,14 @@ const pathname = require('../elements/pathname')
const email = require('../elements/email')
const nav = require('../elements/nav')
module.exports = function (params, state, send) {
module.exports = function (state, prev, send) {
return html`
<main class="mw5 mw7-ns center cf">
${pathname(params, state, send)}
${nav(params, state, send)}
${pathname(state, prev, send)}
${nav(state, prev, send)}
<section class="fl mt4 w-80 db">
${emailList(params, state, send)}
${email(params, state, send)}
${emailList(state, prev, send)}
${email(state, prev, send)}
</section>
</main>
`
+4 -4
View File
@@ -4,12 +4,12 @@ const empty = require('../elements/empty-mailbox')
const pathname = require('../elements/pathname')
const nav = require('../elements/nav')
module.exports = function (params, state, send) {
module.exports = function (state, prev, send) {
return html`
<main class="mw5 mw7-ns center cf">
${pathname(params, state, send)}
${nav(params, state, send)}
${empty(params, state, send)}
${pathname(state, prev, send)}
${nav(state, prev, send)}
${empty(state, prev, send)}
</main>
`
}
+4 -4
View File
@@ -4,13 +4,13 @@ const emailList = require('../elements/email-list')
const pathname = require('../elements/pathname')
const nav = require('../elements/nav')
module.exports = function (params, state, send) {
module.exports = function (state, prev, send) {
return html`
<main class="mw5 mw7-ns center cf">
${pathname(params, state, send)}
${nav(params, state, send)}
${pathname(state, prev, send)}
${nav(state, prev, send)}
<section class="fl mt4 w-80 db">
${emailList(params, state, send)}
${emailList(state, prev, send)}
</section>
</main>
`