Skip to content

Commit

Permalink
Fixes standard-js issue in repo-specific files
Browse files Browse the repository at this point in the history
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
payne-chris-r committed Apr 1, 2017
1 parent 5aeb7a0 commit daaa325
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 25 deletions.
16 changes: 8 additions & 8 deletions assets/scripts/auth/api.js
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
}
26 changes: 13 additions & 13 deletions assets/scripts/auth/events.js
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
}
8 changes: 4 additions & 4 deletions assets/scripts/auth/ui.js
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
}

0 comments on commit daaa325

Please sign in to comment.