blob: af46619b3d0c4d45d7142d2732194faa84086250 [file] [log] [blame]
Matteo Scandolof6acdbe2016-12-13 10:29:37 -08001import {AuthService} from '../../rest/auth.rest';
2
3class LoginCtrl {
4 static $inject = ['AuthService', '$state'];
5
6 /** @ngInject */
7 constructor(
8 private authService: AuthService,
9 private $state: angular.ui.IStateService
10 ) {
11 }
12
13 public login(username: string, password: string) {
14 this.authService.login({
15 username: username,
16 password: password
17 })
18 .then(res => {
19 console.log(res);
20 this.$state.go('app');
21 })
22 .catch(e => console.error);
23 }
24}
25
26export const xosLogin: angular.IComponentOptions = {
27 template: require('./login.html'),
28 controllerAs: 'vm',
29 controller: LoginCtrl
30};