Last active
February 26, 2016 16:19
-
-
Save Austio/2cb4abe7d5c4dd8654f6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.ts | |
@RouteConfig([ | |
{ path: '/login', name: 'Login', component: LoginFormCmp, useAsDefault: true }, | |
{ path: '/home', name: 'Home', component: HomeCmp}, | |
{ path: '/system/health', name: 'SystemHealth', component: SystemHealthCmp } | |
]) | |
login-form.component.ts #REDIRECTS PROPERLY | |
onSubmit(email, password) { | |
let sessionParams = {user_session: {login: email, password: password}}; | |
this.loginService.create(sessionParams).subscribe( | |
response => this.onSuccess(response) | |
); | |
} | |
onSuccess(response) { | |
let authObj = response.data.auth; | |
this.sessionService.setSession(authObj); | |
this.router.navigate(['Home']); | |
} | |
top-nav.ts #DOES NOT REDIRECT PROPERLY, SENDS TO HOME | |
logOut() { | |
this.sessionService.clearSession(); | |
this.router.navigateByUrl(['Login']); | |
} | |
#ALSO TRIED LIKE THIS STILL SENDS TO HOME | |
logOut() { | |
this.sessionService.clearSession(); | |
this.router.navigateByUrl('/login'); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment