Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Problem] Using BeamGuards with sibling BeamLocations #629

Open
chauss opened this issue Jul 18, 2023 · 0 comments
Open

[Problem] Using BeamGuards with sibling BeamLocations #629

chauss opened this issue Jul 18, 2023 · 0 comments

Comments

@chauss
Copy link

chauss commented Jul 18, 2023

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 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?

I'm glad for any help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant