Closed donjae closed 7 years ago
Make the default redirect the main screen and add an auth guard that will check if the user is logged in else redirect him to the login screen
Hmm, ok. If you don't mind, I'm going to keep this question open since your package uses an auth guard with routes in angular2, and I wanted to apply it to Ionic which requires Ionic pages/deep link system. I'll post some code here and close it when I figure out a mock solution
If anyone is looking for the solution, the best way I found was found to create a page-routing service that consists of an event emitter. Keep in mind this solution works with a navController
@Injectable()
export class PageRouteService {
routeLogin = new EventEmitter<any>();
constructor(){
}
}
Then create a subscriber in the app.component on the constructor:
constructor(...){
this.pageRoute.routeLogin.subscribe((data)=>{
console.log(data)
this.nav.push(TabsPage, data);
});
}
this way you can push data from the login screen to any page component you want, or in this case, the tabs page.
Hi,
Was wondering how you would handle users with
ng2-ui-auth_token
already in the local storage, and bypass a login/create account screen. Is there routing logic for ionic to validate with this in ng2-ui-auth?