How do I detect whether a sign-in user is admin or not?

Please fill out as many of the following questions as possible so we can help you promptly! If you don’t know how to answer or it does not apply, feel free to remove it or leave it blank.

Builder content link

Builder public api key
1d8ecee591ac4358befb8fe998100548

What are you trying to accomplish
Is there a way to check whether the current use’s role is admin or not when an user is signed in, similar to “isPreviewing” from “@builder.io/react”.

Thanks. :pray:

Code stack you are integrating Builder with
e.g. NextJS, react, Shopify

Hey @tlee-pb , Currently, Builder.io does not provide a built-in function similar to useIsPreviewing to check the current user’s role directly within the React SDK. However, you can achieve this by leveraging the Builder.io Admin API to fetch the current user’s role and creating a custom hook in React to manage this functionality.