Skip to content

Commit

Permalink
Merge pull request #2 from ozsay/master
Browse files Browse the repository at this point in the history
fix(auth): make auth work with new API
  • Loading branch information
Urigo committed Feb 11, 2016
2 parents 7d600a7 + 21a5326 commit 8e1d4a4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions angular-meteor-auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ angular.module('angular-meteor.auth', [

function $$Auth(vm = this) {
// reset auth properties
this.$autorun(() => {
this.autorun(() => {
vm.currentUser = Accounts.user();
vm.currentUserId = Accounts.userId();
vm.isLoggingIn = Accounts.loggingIn();;
vm.isLoggingIn = Accounts.loggingIn();
});
}

Expand All @@ -38,15 +38,15 @@ angular.module('angular-meteor.auth', [
// once login has failed or user is not valid, otherwise it will be resolved with the current
// user
$$Auth.$awaitUser = function(validate) {
validate = validate ? this.$$bind(validate) : angular.noop;
validate = validate ? this.$bindToContext(validate) : function() {return true};

if (!_.isFunction(validate))
throw Error('argument 1 must be a function');

let deferred = this.$$defer();

let computation = this.$autorun((computation) => {
if (this.$reactivate('isLoggingIn')) return;
let computation = this.autorun((computation) => {
if (this.getReactively('isLoggingIn')) return;
// Stop computation once a user has logged in
computation.stop();

Expand Down

0 comments on commit 8e1d4a4

Please sign in to comment.