-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes standard-js issue in repo-specific files
Didn't make standard on these files for some reason. Also renamed the ui functions to a name that actually makes sense, closing #5 in a better way.
- Loading branch information
1 parent
5aeb7a0
commit daaa325
Showing
3 changed files
with
25 additions
and
25 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,16 +1,16 @@ | ||
'use strict'; | ||
'use strict' | ||
|
||
const signUp = (data) => | ||
new Promise(function (resolve, reject) { | ||
if (Math.random() > 0.5) { | ||
resolve('in signUp'); | ||
resolve('in signUp') | ||
} else { | ||
let error = new Error('Random'); | ||
error.data = data; | ||
reject(error); | ||
const error = new Error('Random') | ||
error.data = data | ||
reject(error) | ||
} | ||
}); | ||
}) | ||
|
||
module.exports = { | ||
signUp, | ||
}; | ||
signUp | ||
} |
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,22 +1,22 @@ | ||
'use strict'; | ||
'use strict' | ||
|
||
const getFormFields = require(`../../../lib/get-form-fields`); | ||
const getFormFields = require(`../../../lib/get-form-fields`) | ||
|
||
const api = require('./api'); | ||
const ui = require('./ui'); | ||
const api = require('./api') | ||
const ui = require('./ui') | ||
|
||
const onSignUp = function (event) { | ||
let data = getFormFields(this); | ||
event.preventDefault(); | ||
const data = getFormFields(this) | ||
event.preventDefault() | ||
api.signUp(data) | ||
.then(ui.success) | ||
.catch(ui.failure); | ||
}; | ||
.then(ui.signUpSuccess) | ||
.catch(ui.signUpFailure) | ||
} | ||
|
||
const addHandlers = () => { | ||
$('#sign-up').on('submit', onSignUp); | ||
}; | ||
$('#sign-up').on('submit', onSignUp) | ||
} | ||
|
||
module.exports = { | ||
addHandlers, | ||
}; | ||
addHandlers | ||
} |
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,14 +1,14 @@ | ||
'use strict' | ||
|
||
const signInSuccess = (data) => { | ||
const signUpSuccess = (data) => { | ||
console.log(data) | ||
} | ||
|
||
const signInFailure = (error) => { | ||
const signUpFailure = (error) => { | ||
console.error(error) | ||
} | ||
|
||
module.exports = { | ||
signInFailure, | ||
signInSuccess | ||
signUpSuccess, | ||
signUpFailure | ||
} |