models: fix state namespace
This commit is contained in:
@@ -14,7 +14,7 @@ module.exports = {
|
||||
}
|
||||
}
|
||||
|
||||
function request (uri, send) {
|
||||
function request (uri, send, state) {
|
||||
http(uri, { json: true }, function (err, res, body) {
|
||||
if (err) return send('app:error', { payload: 'HTTP error' })
|
||||
if (res.statusCode !== 200) {
|
||||
@@ -24,7 +24,6 @@ function request (uri, send) {
|
||||
return send('app:error', { payload: message })
|
||||
}
|
||||
if (!body) {
|
||||
console.log('req made!')
|
||||
return send('app:error', { payload: 'fatal: no body received' })
|
||||
}
|
||||
send('api:set', { payload: body.message || body.title })
|
||||
|
||||
@@ -34,7 +34,7 @@ module.exports = {
|
||||
},
|
||||
effects: {
|
||||
error: function (action, state, send) {
|
||||
const timeout = state.app.errorTimeDone - Date.now()
|
||||
const timeout = state.errorTimeDone - Date.now()
|
||||
setTimeout(function () {
|
||||
send('app:error:delete')
|
||||
}, timeout)
|
||||
|
||||
@@ -6,7 +6,7 @@ const http = require('http')
|
||||
const PORT = 8080
|
||||
|
||||
const server = http.createServer(createRouter())
|
||||
server.listen(PORT, () => console.log(`listening on port ${PORT}`))
|
||||
server.listen(PORT, () => process.stdout.write(`listening on port ${PORT}\n`))
|
||||
|
||||
var index = 0
|
||||
const errors = [
|
||||
|
||||
Reference in New Issue
Block a user