Skip to content

Commit

Permalink
Step 21.4: Move Login class to web.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamil Kisiela authored and Dotan Simha committed Nov 22, 2016
1 parent a6e592f commit 38f9811
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions imports/ui/components/login/web.js
@@ -0,0 +1,30 @@
import { Meteor } from 'meteor/meteor';

export class Login {
constructor($scope, $reactive, $state) {
'ngInject';

this.$state = $state;

$reactive(this).attach($scope);

this.credentials = {
email: '',
password: ''
};

this.error = '';
}

login() {
Meteor.loginWithPassword(this.credentials.email, this.credentials.password,
this.$bindToContext((err) => {
if (err) {
this.error = err;
} else {
this.$state.go('parties');
}
})
);
}
}

0 comments on commit 38f9811

Please sign in to comment.