如何在离子应用程序中进行基于角色的登录,其中我的应用程序目前将有两种类型的用户,admin和user。当管理员登录时,它将指向管理员页面,而当用户登录时,它将指向普通用户页面。
//I think you will get response after successful login,
//In response you will also get userType which identify which type user. after that according to user setRoot page
//setRoot page for not showing login page on back
this.auth.validateUser().then((result) =>{
if(result.status === 200){
if(result.userType === "admin"){
this.navCtrl.setRoot(adminPage);
}
if(result.userType === "user"){
this.navCtrl.setRoot(userPage);
}
}
})