Levels of Access With Firebase
When the Firebase Auth element instantializes, the element will check for the existence of a cookie to determine if the user is signed in or not. Based on this, you may redirect the user to different pages depending on the sign in state using the actions onSignedIn, onSignedOut, and getCurrentUser.
This is a complex example where there are two trees of events:
1) onSignedOut: If the user is signed out, the Sequence element will ensure that the screen for admins and employees is deactivated and activate the login screen.
2) onSignedIn: If the user is signed in, we will use the data from getCurrentUser and switch the use case based on which user we have using the Switch element. Regardless of whether the user is an admin or an employee, we will activate the appropriate screen and ensure the others are deactivated using the Sequence element.