Skip to content

Instantly share code, notes, and snippets.

@BenGitsCode
Created January 20, 2017 03:12
Show Gist options
  • Save BenGitsCode/f7091e46d97425998a7e5de616be4dd1 to your computer and use it in GitHub Desktop.
Save BenGitsCode/f7091e46d97425998a7e5de616be4dd1 to your computer and use it in GitHub Desktop.
Scaffold Sample User Click Handlers
'use strict';
const authApi = require('./api-user');
// const authApiNodes = require('./api-nodes'); Not being used ATM
const authUi = require('./ui-user');
const app = require('../app-data');
const userEventHandlers = () => {
$('#sign-up').on('submit', function (event) {
event.preventDefault();
let data = getFormFields(this);
app.server.signUpData = getFormFields(this);
authApi.signUp(authUi.signUpSuccess, authUi.signUpFailure, data);
});
$('#sign-in').on('submit', function (event) {
let data = getFormFields(this);
event.preventDefault();
authApi.signIn(authUi.signInSuccess, authUi.signInFailure, data);
});
$('#sign-out').on('click', function (event) {
event.preventDefault();
authApi.signOut(authUi.signOutSuccess, authUi.failure);
console.log("signed out");
});
$('#change-password').on('submit', function (event) {
event.preventDefault();
let data = getFormFields(this);
authApi.changePass(authUi.changePwSuccess, authUi.changePwFailure, data);
console.log(data);
});
};
module.exports = {
userEventHandlers,
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment