vipul
Posts: 0
Joined: Wed Jul 31, 2013 8:59 am

How to navigate to different page through login page on the basis of userType

Hi
I have three different types of users
Now on login page depends on the user type a different page will open
How to achieve this.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

How to navigate to different page through login page on the basis of userType

Hi,

After getting user _id on successful authorization you can at once send one more request for getting user type and choose needed screen basing on the response .

This can be implemented by checking response (arguments[0]) on service requesting user type Success event.

vipul
Posts: 0
Joined: Wed Jul 31, 2013 8:59 am

How to navigate to different page through login page on the basis of userType

All users entry is in User Table and for that I there is only Login service present,
and no query service, so in that case how will i query for user type.

Oleg Danchenkov
Posts: 0
Joined: Tue Apr 30, 2013 5:51 pm

How to navigate to different page through login page on the basis of userType

You should create REST service with parameters described here http://docs.appery.io/documentation/b...

vipul
Posts: 0
Joined: Wed Jul 31, 2013 8:59 am

How to navigate to different page through login page on the basis of userType

Hi Oleg
I have created new service with three parameters
database id
session token
where
but it is not working
is there some other way to add where clause in the request of rest service

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

How to navigate to different page through login page on the basis of userType

Hi,

How do you use these parameters?

vipul
Posts: 0
Joined: Wed Jul 31, 2013 8:59 am

How to navigate to different page through login page on the basis of userType

There is a user table in the database in which I have added some users,
In this table there are three Columns (UserName,Password and UserType)

Now after login i need to navigate to different pages on the basis of UserType and for this I have created a RestService which will do query on UserTable and return userType. and on the basis of userType navigation will happen.

In this service I have added 1 parameter "where" in which i am passing
{"UserName":"username"};

but it is not working thats why i wanted to know is there any other way to add where clause as a paremeter.

Oleg Danchenkov
Posts: 0
Joined: Tue Apr 30, 2013 5:51 pm

How to navigate to different page through login page on the basis of userType

You can add JS in Request mapping to "where" parameter.
Check this for more information http://docs.appery.io/tutorials/build...

vipul
Posts: 0
Joined: Wed Jul 31, 2013 8:59 am

How to navigate to different page through login page on the basis of userType

Hi Oleg
I have already added Java Script
return '{"username":"'+value+'"}';

Given below are the logs
[22:56:02.139] GET https://api.appery.io/rest/1/db/login... [HTTP/1.1 200 OK 310ms]
[22:56:02.532] OPTIONS https://api.appery.io/rest/1/db/users... [HTTP/1.1 200 OK 311ms]
[22:56:02.901] GET https://api.appery.io/rest/1/db/users... [HTTP/1.1 200 OK 320ms]

I have shared my project on appery support, can you just chk it once

Oleg Danchenkov
Posts: 0
Joined: Tue Apr 30, 2013 5:51 pm

How to navigate to different page through login page on the basis of userType

So, as I see you want to get user info not from collection in DB but from Users table.
In this case you don't need "where" parameter. Check this out http://docs.appery.io/documentation/b...

1) Set Url parameter of service to
https://api.appery.io/rest/1/db/users...
2) Add 3 request parameters
X-Appery-Database-Id (check header)
X-Appery-Session-Token (check header)
userID

And don't forget, you should map user id (not UserName) to userID parameter.
(user id that was returned in response of login service. you can save it to localStorage)

Return to “Issues”