/* General client code */

Template.login.events({
  'click #venmo-login': function(event) {
      Meteor.loginWithVenmo(function (err, res) {
        if (err){
        	console.log(err);
          throw new Meteor.Error("Login failed"); 
        }
        Meteor.call("after_login", function(err) {
        	if (err) {
        		throw new Meteor.Error("Unable to update friends.");
        	}
        });
        Router.go('/');
      });
  }
});

Template.home.events({
  'click #create': function(event) {
      Router.go('/create');
  }
});

Template.create.events({
    
});


Template.createPurchase.events({

});

Template.createPurchase.helpers({
  'friends': function() {
    return 
  }
});

var events = {
  'click #logout': function(event) {
    Meteor.logout(function(err){
        if (err) {
            throw new Meteor.Error("Logout failed");
        }
        Router.go('/');
    });
  }
}

Template.BaseLayout.events(events);
Template.home.events(events);
Template.create.events(events);

Template.registerHelper('click #logout', function(event) {
    Meteor.logout(function(err){
        if (err) {
            throw new Meteor.Error("Logout failed");
        }
        Router.go('/');
    });
});

Template.registerHelper('getProfilePictureUrl', function() {
    var user = Meteor.user();
    return user.services.venmo.profile_picture_url
});


@@ -1004,219 +1004,8 @@
 );%0A%0A
-Template.registerHelper('click #logout', function(event) %7B%0A    Meteor.logout(function(err)%7B%0A        if (err) %7B%0A            throw new Meteor.Error(%22Logout failed%22);%0A        %7D%0A        Router.go('/');%0A    %7D);%0A%7D);%0A%0A
 Temp

remove logout helper