nareshbhatia / mobx-state-router

MobX-powered router for React apps
https://nareshbhatia.github.io/mobx-state-router/
MIT License
227 stars 31 forks source link

Removed #143

Closed ghost closed 6 months ago

ghost commented 2 years ago

Removed

nareshbhatia commented 2 years ago

@yourikoeman, glad to hear that you are finding this project useful.

Regarding your issue, have you seen this recipe in the docs: https://nareshbhatia.github.io/mobx-state-router/docs/guides-recipes#redirecting-to-the-sign-in-page? Does it address your problem?

Of course, this means that you have to add the beforeEnter on every private route, but it gives the flexibility to have some public routes too. If I understand you correctly, with a global beforeEnter() you will loose the ability to mark some routes as public.

ghost commented 2 years ago

Removed

nareshbhatia commented 2 years ago

@yourikoeman, I see your point now. Please feel free to send a PR.

To confirm my understanding:

  1. You will add a global beforeEnter hook.
  2. This will be added as a special option which can be passed into the 3rd parameter of RouterStore. Type will be TransitionHook.
  3. Can you please name this option globalBeforeEnter, just so that people don't get confused with Route.beforeEnter?

Please keep changes to minimal necessary and make sure that all existing tests are running successfully.

ghost commented 2 years ago

Removed

nareshbhatia commented 2 years ago

Thanks @yourikoeman.

No special considerations regarding updating of tests and documentation - just an overall focus on quality. I will of course be reviewing to make sure everything is in order.

ghost commented 2 years ago

Removed