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 DAB0mB committed Dec 14, 2016
1 parent b046579 commit 56ca212
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 56ca212

Please sign in to comment.