Skip to content

Commit 8f7c295

Browse files
committed
fix(client:login): allow routing after login
1 parent 6fd6318 commit 8f7c295

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

templates/app/client/app/account(auth)/login/login.component.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { Component } from '@angular/core';
22
<%_ if(filters.uirouter) { -%>
33
import { StateService } from 'ui-router-ng2';<% } %>
4-
<%_ if(filters.ngroute) { -%><% } %>
4+
<%_ if(filters.ngroute) { -%>
5+
import { Router } from '@angular/router';<% } %>
56
import { 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

Comments
 (0)