blob: 51dc7c9886907a5b116dd1c218becc80fd3a2d87 [file] [log] [blame]
import {AuthService} from '../../rest/auth.rest';
class LoginCtrl {
static $inject = ['AuthService', '$state'];
/** @ngInject */
constructor(
private authService: AuthService,
private $state: angular.ui.IStateService
) {
}
public login(username: string, password: string) {
this.authService.login({
username: username,
password: password
})
.then(res => {
this.$state.go('xos.dashboard');
})
.catch(e => console.error);
}
}
export const xosLogin: angular.IComponentOptions = {
template: require('./login.html'),
controllerAs: 'vm',
controller: LoginCtrl
};