i have a project in ionic 5 . after successful login and close the app after again opening the app shows a 1 sec login page and then redirect to routed page ,which my case is home how to prevent it from showing the page using guard
i have done these and getting device fireup issue
route page
path: '',
canActivate:[LoginGuard],
children:[
]
LoginGuard page
public async canActivate(
route: ActivatedRouteSnapshot,
state: RouterStateSnapshot): Promise<any> {
let res = await this.storage.get('loggedIn');
console.log(res)
if (res == null) res = 0
if(res == 0){
return this.route.parseUrl('/login');
}else if (res == 1) {
return this.route.parseUrl('/home');
}
}
I removed/commented out:
And added authentication check and redirection in app.components.ts as I did in ionic 3... Which works I guess for now.