How to Conditionally render a page based on a user role
Like i have a chnage password page which has a form so i want to show the form only when the user role is admin and or else show 401
I have used this visibility logic for the full page block which contains a form
this works as expected
but for non Admin login its shows the form for a few seconds and than disables
Any solutn for it?
This option uses dataLoaded and showForm. The second option is better because you can show the spinner for the whole page on the dataLoaded false property, and when the logic loads, show the form you want or not.
So on page enter, i’ll do the API call etc and set 2 values show form if admin and data loaded
and then give visibility logic where it will check for these 2 variables ryt?
and where to get “and” from just next to return in the 1st image
So on page enter, i’ll do the API call etc and set 2 values show form if admin and data loaded
and then give visibility logic where it will check for these 2 variables ryt?
Yes, you are right. Be sure to set display false by default for the form before.
and where to get “and” from just next to return in the 1st image