I am following redux form tutorial and almost done with that but could not pass the array in asyncValidate file
I need to change array ['john', 'paul', 'george', 'ringo'] with the array coming from server response...
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms))
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