Search.../

role

Gets the user's role.

Description

Gets one of the following roles:

  • "Admin" — The owner of the site.
  • "Member" — A user who is logged in.
  • "Visitor" — A user who is not logged in.

Note: The APIs in WixRouterUser are only partially functional when previewing your site. View a published version of your site to see their complete functionality.

Type:

stringRead Only

Was this helpful?

Get the user from the router request

Copy Code
1export function myRouter_Router(request) {
2 let user = request.user;
3 let userId = user.id; // "f6q0fb32-b06r-469f-ag4d-9df89afkj5d9"
4 let role = user.role; // "Admin"
5}