Mohd Izzar
Posts: 0
Joined: Fri Feb 22, 2019 9:28 am

Navigate page based on login Username

Hi, I would like to do a login, where it will navigate user to their page based on their username. For example, Admin will go to Screen1 and User1 will go to Screen2. How do I achieve this?

I am kinda new with coding. Hope there is some documentation or example regarding this. Thanks!

Mohd Izzar
Posts: 0
Joined: Fri Feb 22, 2019 9:28 am

Navigate page based on login Username

Oh, apparently I just have to add this in my login code:

Apperyio.navigateTo("Screen1", {username:"Maintenance"});

Sorry for the trouble :)

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Navigate page based on login Username

Hello Mohd,

Please read user's item after the login service, and check the role there.
Here you can find the similar topic: https://getsatisfaction.com/apperyio/...

If you need to navigate the user to the specific page using his role, please use the method prevar nextPage = "";
if (user.role === "admin"){
nextPage = "adminPage";
} else {
nextPage = "defaultPage";
}
Apperyio.navigateTo(nextPage);/pre
here adminPage and defaultPage - pages, need to open for the specific user

Mohd Izzar
Posts: 0
Joined: Fri Feb 22, 2019 9:28 am

Navigate page based on login Username

What if, I want to navigate user using his username? So, I need to change it so, it read the user username?

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Navigate page based on login Username

Sure, you can use their names for the navigation, if you have a limited list of users

Return to “Issues”