11import { Component } from '@angular/core' ;
22< % _ if ( filters . uirouter ) { - % >
33import { StateService } from 'ui-router-ng2' ; < % } % >
4- < % _ if ( filters . ngroute ) { - % > < % } % >
4+ < % _ if ( filters . ngroute ) { - % >
5+ import { Router } from '@angular/router' ; < % } % >
56import { AuthService } from '../../../components/auth/auth.service';
67
78// @flow
@@ -37,10 +38,11 @@ export class LoginComponent {
3738 < % _ if ( filters . uirouter ) { - % >
3839 StateService;< % } % >
3940
40- static parameters = [ AuthService , < % if ( filters . ngroute ) { % > < % } else { % > StateService < % } % > ] ;
41- constructor ( _AuthService_ : AuthService , < % if ( filters . ngroute ) { % > < % } else { % > _StateService_ : StateService < % } % > ) {
41+ static parameters = [AuthService, < % if ( filters . ngroute ) { % > Router < % } else { % > StateService < % } %> ] ;
42+ constructor ( _AuthService_ : AuthService , < % if ( filters . ngroute ) { % > router: Router < % } else { % > _StateService_ : StateService < % } %> ) {
4243 this . AuthService = _AuthService_ ;
43- < % _ if ( filters . ngroute ) { - % > < % } % >
44+ < % _ if ( filters . ngroute ) { - % >
45+ this . Router = router ; < % } %>
4446 < % _ if ( filters . uirouter ) { - % >
4547 this.StateService = _StateService_;< % } % >
4648 }
@@ -54,7 +56,10 @@ export class LoginComponent {
5456 } )
5557 . then ( ( ) => {
5658 // Logged in, redirect to home
57- this . StateService . go ( 'main' ) ;
59+ < % _ if ( filters . ngroute ) { - % >
60+ this . Router . navigateByUrl ( '/home' ) ; < % } % >
61+ < % _ if ( filters . uirouter ) { - % >
62+ this . StateService . go ( 'main' ) ; < % } % >
5863 } )
5964 . catch ( err => {
6065 this . errors . login = err . message ;
0 commit comments