diff --git a/examples/http/client.js b/examples/http/client.js index 44974b3..6c6e6fb 100644 --- a/examples/http/client.js +++ b/examples/http/client.js @@ -10,12 +10,12 @@ const app = choo({ const send = createSend('onError: ') send('app:error', err) }, - onAction: function (action, state, name, caller, createSend) { + onAction: function (data, state, name, caller, createSend) { console.groupCollapsed(`Action: ${caller} -> ${name}`) - console.log(action) + console.log(data) console.groupEnd() }, - onState: function (action, state, prev, createSend) { + onState: function (data, state, prev, createSend) { console.groupCollapsed('State') console.log(prev) console.log(state) diff --git a/examples/http/models/api.js b/examples/http/models/api.js index e7bd2c0..9fd5826 100644 --- a/examples/http/models/api.js +++ b/examples/http/models/api.js @@ -6,13 +6,13 @@ module.exports = { title: 'Button pushing machine 3000' }, reducers: { - set: (action, state) => ({ 'title': action.data }) + set: (data, state) => ({ 'title': data }) }, effects: { - good: function (action, state, send, done) { + good: function (data, state, send, done) { request('/good', send, done) }, - bad: (action, state, send, done) => request('/bad', send, done) + bad: (data, state, send, done) => request('/bad', send, done) } } @@ -26,6 +26,6 @@ function request (uri, send, done) { return done(new Error(message)) } if (!body) return done(new Error('fatal: no body received')) - send('api:set', { data: body.message || body.title }, done) + send('api:set', body.message || body.title, done) }) } diff --git a/examples/http/models/error.js b/examples/http/models/error.js index b3e0cea..bd1620a 100644 --- a/examples/http/models/error.js +++ b/examples/http/models/error.js @@ -15,13 +15,13 @@ module.exports = { triggerTime: null }, reducers: { - setError: function (action, state) { + setError: function (data, state) { return { - errors: state.errors.concat(action.message), - errorTimeDone: action.errorTimeDone + errors: state.errors.concat(data.message), + errorTimeDone: data.errorTimeDone } }, - 'delError': function (action, state) { + 'delError': function (data, state) { state.errors.shift() return { errors: state.errors } } diff --git a/examples/sse/client.js b/examples/sse/client.js index e014f4f..6f606d8 100644 --- a/examples/sse/client.js +++ b/examples/sse/client.js @@ -35,13 +35,13 @@ function createModel () { } ], reducers: { - 'print': (action, state) => { - return ({ msg: state.msg + ' ' + action.payload }) + 'print': (data, state) => { + return ({ msg: state.msg + ' ' + data.payload }) } }, effects: { close: () => stream.close(), - error: (action, state) => console.error(`error: ${action.payload}`) + error: (data, state) => console.error(`error: ${data.payload}`) } } } diff --git a/examples/title/client.js b/examples/title/client.js index 3ea603d..35f4dc8 100644 --- a/examples/title/client.js +++ b/examples/title/client.js @@ -8,10 +8,10 @@ app.model({ title: 'my demo app' }, reducers: { - update: (action, state) => ({ title: action.payload }) + update: (data, state) => ({ title: data.payload }) }, effects: { - update: (action, state, send) => (document.title = action.payload) + update: (data, state, send) => (document.title = data.payload) } })