forked from redux-form/redux-form
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Formatted with better prettier settings
- Loading branch information
Showing
203 changed files
with
5,868 additions
and
7,564 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,29 @@ | ||
var path = require('path'); | ||
var express = require('express'); | ||
var webpack = require('webpack'); | ||
var config = require('./webpack.config.dev'); | ||
var path = require('path') | ||
var express = require('express') | ||
var webpack = require('webpack') | ||
var config = require('./webpack.config.dev') | ||
|
||
var app = express(); | ||
var compiler = webpack(config); | ||
var app = express() | ||
var compiler = webpack(config) | ||
|
||
app.use(require('webpack-dev-middleware')(compiler, { | ||
noInfo: true, | ||
publicPath: config.output.publicPath | ||
})); | ||
app.use( | ||
require('webpack-dev-middleware')(compiler, { | ||
noInfo: true, | ||
publicPath: config.output.publicPath, | ||
}) | ||
) | ||
|
||
app.use(require('webpack-hot-middleware')(compiler)); | ||
app.use(require('webpack-hot-middleware')(compiler)) | ||
|
||
app.get('*', function(req, res) { | ||
res.sendFile(path.join(__dirname, 'index.html')); | ||
}); | ||
res.sendFile(path.join(__dirname, 'index.html')) | ||
}) | ||
|
||
app.listen(3030, 'localhost', function(err) { | ||
if (err) { | ||
console.log(err); | ||
return; | ||
console.log(err) | ||
return | ||
} | ||
|
||
console.log('Listening at http://localhost:3030'); | ||
}); | ||
console.log('Listening at http://localhost:3030') | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms)) | ||
|
||
const asyncValidate = (values/*, dispatch */) => { | ||
return sleep(1000) // simulate server latency | ||
.then(() => { | ||
if ([ 'john', 'paul', 'george', 'ringo' ].includes(values.username)) { | ||
throw { username: 'That username is taken' } | ||
} | ||
}) | ||
const asyncValidate = (values /*, dispatch */) => { | ||
return sleep(1000).then(() => { | ||
// simulate server latency | ||
if (['john', 'paul', 'george', 'ringo'].includes(values.username)) { | ||
throw {username: 'That username is taken'} | ||
} | ||
}) | ||
} | ||
|
||
export default asyncValidate | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import { combineReducers } from 'redux' | ||
import { reducer as formReducer } from 'redux-form' | ||
import {combineReducers} from 'redux' | ||
import {reducer as formReducer} from 'redux-form' | ||
import validate from './validate' | ||
|
||
const reducer = combineReducers({ | ||
form: formReducer.validation({ | ||
asyncValidation: validate // "asyncValidation" is the form name given to reduxForm() decorator | ||
}) | ||
asyncValidation: validate, // "asyncValidation" is the form name given to reduxForm() decorator | ||
}), | ||
}) | ||
|
||
export default reducer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,3 @@ const validate = values => { | |
} | ||
|
||
export default validate | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,29 @@ | ||
var path = require('path'); | ||
var express = require('express'); | ||
var webpack = require('webpack'); | ||
var config = require('./webpack.config.dev'); | ||
var path = require('path') | ||
var express = require('express') | ||
var webpack = require('webpack') | ||
var config = require('./webpack.config.dev') | ||
|
||
var app = express(); | ||
var compiler = webpack(config); | ||
var app = express() | ||
var compiler = webpack(config) | ||
|
||
app.use(require('webpack-dev-middleware')(compiler, { | ||
noInfo: true, | ||
publicPath: config.output.publicPath | ||
})); | ||
app.use( | ||
require('webpack-dev-middleware')(compiler, { | ||
noInfo: true, | ||
publicPath: config.output.publicPath, | ||
}) | ||
) | ||
|
||
app.use(require('webpack-hot-middleware')(compiler)); | ||
app.use(require('webpack-hot-middleware')(compiler)) | ||
|
||
app.get('*', function(req, res) { | ||
res.sendFile(path.join(__dirname, 'index.html')); | ||
}); | ||
res.sendFile(path.join(__dirname, 'index.html')) | ||
}) | ||
|
||
app.listen(3030, 'localhost', function(err) { | ||
if (err) { | ||
console.log(err); | ||
return; | ||
console.log(err) | ||
return | ||
} | ||
|
||
console.log('Listening at http://localhost:3030'); | ||
}); | ||
console.log('Listening at http://localhost:3030') | ||
}) |
Oops, something went wrong.