Situation
I am using a BottomNavigationBar that has currently two items. The first HomeLocation has content that is open to all users, the second UserLocation is kind of the user profile section and has a BeamerGuard set to guard all behind the LoginPage.
Code: Locations
Those two locations are siblings, just as in the BottomNavigationBar Example. They are both added to a Stack that then decides which one to display depending on the current urlPath and the interaction of the user (click on the bottomNavigationBar).
Code: AppScreen with Stack
Code: BeamerDelegate-Configuration
The defaultRoute for the UserLocation is the url to the "MyRecipes"-Page in the app that is being guarded.
Problem
When one opens the application as a guest (not logged in) with a urlPath that leads to the HomeLocation (eg. /home/overview) the application loads both sibling BeamLocations with their initialPath if not changed by the given url.
So the HomeLocation is loading: /home/overview
And the UserLocation is loading: /user/myRecipes which is guarded and since the user is not logged in the BeamGuard activates and says "no you won't go to /user/myRecipes, you go to /login" and it beamsToNamed = /login.
That beamToNamed in the BeamGuard now overwrites the current urlPath of the user even though the user actually is in the HomeLocation where he/she can be freely without login. So initially going to a page via urlPath it always goes to /login when no user is logged in.
So what I kind of need is a way to protect the one sibling path of the navigation without affecting the user as long as he/she is on the "free for all" path of the navigation.
Am I doing something crucially wrong or do any of you have a proper solution on how to solve this issue?
Beamer version: 1.5.6
Situation I am using a BottomNavigationBar that has currently two items. The first
HomeLocation
has content that is open to all users, the secondUserLocation
is kind of the user profile section and has aBeamerGuard
set to guard all behind theLoginPage
. Code: Locations Those two locations are siblings, just as in the BottomNavigationBar Example. They are both added to a Stack that then decides which one to display depending on the current urlPath and the interaction of the user (click on the bottomNavigationBar). Code: AppScreen with Stack Code: BeamerDelegate-Configuration The defaultRoute for theUserLocation
is the url to the "MyRecipes"-Page in the app that is being guarded.Problem When one opens the application as a guest (not logged in) with a urlPath that leads to the
HomeLocation
(eg. /home/overview) the application loads both siblingBeamLocations
with their initialPath if not changed by the given url. So theHomeLocation
is loading: /home/overview And theUserLocation
is loading: /user/myRecipes which is guarded and since the user is not logged in theBeamGuard
activates and says "no you won't go to /user/myRecipes, you go to /login" and it beamsToNamed = /login.That beamToNamed in the
BeamGuard
now overwrites the current urlPath of the user even though the user actually is in theHomeLocation
where he/she can be freely without login. So initially going to a page via urlPath it always goes to /login when no user is logged in.So what I kind of need is a way to protect the one sibling path of the navigation without affecting the user as long as he/she is on the "free for all" path of the navigation.
Am I doing something crucially wrong or do any of you have a proper solution on how to solve this issue?
I'm glad for any help!