-
Notifications
You must be signed in to change notification settings - Fork 39
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
Where's the code that redirects to /login? #15
Comments
Hi @jsoriao ! You are not able to find that code because it's not located in this repo 😄 . As you can see in root-application.js file, the unique single-spa application that is mounted only in logged in routes is the single-spa-layout-app. For this reason, I decided to locate in that repository the needed code for redirect to login page if you try to access to a protected route without the required grants, in this case a simple JWT token. You can find the code here: https://github.com/jualoppaz/single-spa-layout-app/blob/master/src/App.vue#L23 beforeCreate() {
if (!sessionStorage.getItem('token')) {
window.history.pushState(null, null, '/login');
}
...
} I did it by this way for the reason I explained you, but you can choose so many other strategies like listening all route changes in your own root-applications.js file. It all depends on developer decision as there is no single-spa official way. Hope this guidelines be useful for you. |
I'm trying to understand the root-application.js but cannot understand where's the code that redirects to /login when user's not authenticated. Can you help me understand it more?
The text was updated successfully, but these errors were encountered: