The module renders components based on roles.
Pre-requisites
Roles must be stored in the local storage with the key as roles.
The values must be something like ROLE_USER,ROLE_ADMIN
Usage:
; Component { return <Secure roles='ROLE_USER''ROLE_ADMIN' components= <Col lg=4> <div>Hello World!</div> </Col> /> }
Props explanantion
roles : Pass array of roles you want the user to have to view the component.
components: Pass the components you want to render conditionally.
Notes on how to use:
Make an API Call to your backend and get the roles the logged in user has.
Save the roles in local storage. Use the secure-role-component module as above to get conditional rendering.